Closed as not planned
Description
π Search Terms
The generic type cannot be successfully inferred.
π Version & Regression Information
5.3
β― Playground Link
π» Code
type test_b<T, CTX> = T extends {} ? { [K in keyof T]: T[K] extends (ctx: any, opts: any, ...args: infer P) => infer R ? (ctx: CTX, opts: { kkk: number }, ...args: P) => R : never } : 2;
function aaaa<D, T>(t: { d?: D, f?: T | test_b<T, { sss: number }> }) { }
aaaa({
// d: { sss: 123 }, // Commenting this line out will yield different results.
f: {
a(ctx, opts, aaa) {
ctx.sss
},
b(ctx, opts, aaa) {
ctx.sss
},
c(ctx, opts, aaa) {
ctx.sss
},
sss: '@start',
},
})
π Actual behavior
The error occurred after set d
.
π Expected behavior
It should always converge successfully.
Additional information about the issue
No response