|
| 1 | +//// [tests/cases/compiler/genericCallInferenceWithGenericLocalFunction.ts] //// |
| 2 | + |
| 3 | +=== genericCallInferenceWithGenericLocalFunction.ts === |
| 4 | +// https://github.com/microsoft/TypeScript/issues/43961 |
| 5 | + |
| 6 | +const createTransform = <I, O>(tr: (from: I) => O) => tr; |
| 7 | +>createTransform : Symbol(createTransform, Decl(genericCallInferenceWithGenericLocalFunction.ts, 2, 5)) |
| 8 | +>I : Symbol(I, Decl(genericCallInferenceWithGenericLocalFunction.ts, 2, 25)) |
| 9 | +>O : Symbol(O, Decl(genericCallInferenceWithGenericLocalFunction.ts, 2, 27)) |
| 10 | +>tr : Symbol(tr, Decl(genericCallInferenceWithGenericLocalFunction.ts, 2, 31)) |
| 11 | +>from : Symbol(from, Decl(genericCallInferenceWithGenericLocalFunction.ts, 2, 36)) |
| 12 | +>I : Symbol(I, Decl(genericCallInferenceWithGenericLocalFunction.ts, 2, 25)) |
| 13 | +>O : Symbol(O, Decl(genericCallInferenceWithGenericLocalFunction.ts, 2, 27)) |
| 14 | +>tr : Symbol(tr, Decl(genericCallInferenceWithGenericLocalFunction.ts, 2, 31)) |
| 15 | + |
| 16 | +function withP2<P>(p: P) { |
| 17 | +>withP2 : Symbol(withP2, Decl(genericCallInferenceWithGenericLocalFunction.ts, 2, 57)) |
| 18 | +>P : Symbol(P, Decl(genericCallInferenceWithGenericLocalFunction.ts, 4, 16)) |
| 19 | +>p : Symbol(p, Decl(genericCallInferenceWithGenericLocalFunction.ts, 4, 19)) |
| 20 | +>P : Symbol(P, Decl(genericCallInferenceWithGenericLocalFunction.ts, 4, 16)) |
| 21 | + |
| 22 | + const m = <I,>(from: I) => ({ ...from, ...p }); |
| 23 | +>m : Symbol(m, Decl(genericCallInferenceWithGenericLocalFunction.ts, 5, 7)) |
| 24 | +>I : Symbol(I, Decl(genericCallInferenceWithGenericLocalFunction.ts, 5, 13)) |
| 25 | +>from : Symbol(from, Decl(genericCallInferenceWithGenericLocalFunction.ts, 5, 17)) |
| 26 | +>I : Symbol(I, Decl(genericCallInferenceWithGenericLocalFunction.ts, 5, 13)) |
| 27 | +>from : Symbol(from, Decl(genericCallInferenceWithGenericLocalFunction.ts, 5, 17)) |
| 28 | +>p : Symbol(p, Decl(genericCallInferenceWithGenericLocalFunction.ts, 4, 19)) |
| 29 | + |
| 30 | + return createTransform(m); |
| 31 | +>createTransform : Symbol(createTransform, Decl(genericCallInferenceWithGenericLocalFunction.ts, 2, 5)) |
| 32 | +>m : Symbol(m, Decl(genericCallInferenceWithGenericLocalFunction.ts, 5, 7)) |
| 33 | +} |
| 34 | + |
| 35 | +const addP2 = withP2({ foo: 1 }); |
| 36 | +>addP2 : Symbol(addP2, Decl(genericCallInferenceWithGenericLocalFunction.ts, 9, 5)) |
| 37 | +>withP2 : Symbol(withP2, Decl(genericCallInferenceWithGenericLocalFunction.ts, 2, 57)) |
| 38 | +>foo : Symbol(foo, Decl(genericCallInferenceWithGenericLocalFunction.ts, 9, 22)) |
| 39 | + |
| 40 | +const added2 = addP2({ bar: 2 }); |
| 41 | +>added2 : Symbol(added2, Decl(genericCallInferenceWithGenericLocalFunction.ts, 10, 5)) |
| 42 | +>addP2 : Symbol(addP2, Decl(genericCallInferenceWithGenericLocalFunction.ts, 9, 5)) |
| 43 | +>bar : Symbol(bar, Decl(genericCallInferenceWithGenericLocalFunction.ts, 10, 22)) |
| 44 | + |
0 commit comments