|
| 1 | +=== tests/cases/compiler/mappedTypeInferenceAliasSubstitution.ts === |
| 2 | +// repro from #31616 |
| 3 | + |
| 4 | +const v = { test: { smth: 5 } }; |
| 5 | +>v : Symbol(v, Decl(mappedTypeInferenceAliasSubstitution.ts, 2, 5)) |
| 6 | +>test : Symbol(test, Decl(mappedTypeInferenceAliasSubstitution.ts, 2, 11)) |
| 7 | +>smth : Symbol(smth, Decl(mappedTypeInferenceAliasSubstitution.ts, 2, 19)) |
| 8 | + |
| 9 | +type Field<A extends string, R> = { [K in A]: R } |
| 10 | +>Field : Symbol(Field, Decl(mappedTypeInferenceAliasSubstitution.ts, 2, 32)) |
| 11 | +>A : Symbol(A, Decl(mappedTypeInferenceAliasSubstitution.ts, 4, 11)) |
| 12 | +>R : Symbol(R, Decl(mappedTypeInferenceAliasSubstitution.ts, 4, 28)) |
| 13 | +>K : Symbol(K, Decl(mappedTypeInferenceAliasSubstitution.ts, 4, 37)) |
| 14 | +>A : Symbol(A, Decl(mappedTypeInferenceAliasSubstitution.ts, 4, 11)) |
| 15 | +>R : Symbol(R, Decl(mappedTypeInferenceAliasSubstitution.ts, 4, 28)) |
| 16 | + |
| 17 | +const f = <A extends string, B extends string, R>(x: { [K in A]: Field<B, R> }): R => ({} as any); |
| 18 | +>f : Symbol(f, Decl(mappedTypeInferenceAliasSubstitution.ts, 6, 5)) |
| 19 | +>A : Symbol(A, Decl(mappedTypeInferenceAliasSubstitution.ts, 6, 11)) |
| 20 | +>B : Symbol(B, Decl(mappedTypeInferenceAliasSubstitution.ts, 6, 28)) |
| 21 | +>R : Symbol(R, Decl(mappedTypeInferenceAliasSubstitution.ts, 6, 46)) |
| 22 | +>x : Symbol(x, Decl(mappedTypeInferenceAliasSubstitution.ts, 6, 50)) |
| 23 | +>K : Symbol(K, Decl(mappedTypeInferenceAliasSubstitution.ts, 6, 56)) |
| 24 | +>A : Symbol(A, Decl(mappedTypeInferenceAliasSubstitution.ts, 6, 11)) |
| 25 | +>Field : Symbol(Field, Decl(mappedTypeInferenceAliasSubstitution.ts, 2, 32)) |
| 26 | +>B : Symbol(B, Decl(mappedTypeInferenceAliasSubstitution.ts, 6, 28)) |
| 27 | +>R : Symbol(R, Decl(mappedTypeInferenceAliasSubstitution.ts, 6, 46)) |
| 28 | +>R : Symbol(R, Decl(mappedTypeInferenceAliasSubstitution.ts, 6, 46)) |
| 29 | + |
| 30 | +const r1 = f(v); |
| 31 | +>r1 : Symbol(r1, Decl(mappedTypeInferenceAliasSubstitution.ts, 7, 5)) |
| 32 | +>f : Symbol(f, Decl(mappedTypeInferenceAliasSubstitution.ts, 6, 5)) |
| 33 | +>v : Symbol(v, Decl(mappedTypeInferenceAliasSubstitution.ts, 2, 5)) |
| 34 | + |
| 35 | +const g = <A extends string, B extends string, R>(x: Field<A, Field<B, R>>): R => ({} as any); |
| 36 | +>g : Symbol(g, Decl(mappedTypeInferenceAliasSubstitution.ts, 9, 5)) |
| 37 | +>A : Symbol(A, Decl(mappedTypeInferenceAliasSubstitution.ts, 9, 11)) |
| 38 | +>B : Symbol(B, Decl(mappedTypeInferenceAliasSubstitution.ts, 9, 28)) |
| 39 | +>R : Symbol(R, Decl(mappedTypeInferenceAliasSubstitution.ts, 9, 46)) |
| 40 | +>x : Symbol(x, Decl(mappedTypeInferenceAliasSubstitution.ts, 9, 50)) |
| 41 | +>Field : Symbol(Field, Decl(mappedTypeInferenceAliasSubstitution.ts, 2, 32)) |
| 42 | +>A : Symbol(A, Decl(mappedTypeInferenceAliasSubstitution.ts, 9, 11)) |
| 43 | +>Field : Symbol(Field, Decl(mappedTypeInferenceAliasSubstitution.ts, 2, 32)) |
| 44 | +>B : Symbol(B, Decl(mappedTypeInferenceAliasSubstitution.ts, 9, 28)) |
| 45 | +>R : Symbol(R, Decl(mappedTypeInferenceAliasSubstitution.ts, 9, 46)) |
| 46 | +>R : Symbol(R, Decl(mappedTypeInferenceAliasSubstitution.ts, 9, 46)) |
| 47 | + |
| 48 | +const r2 = g(v); |
| 49 | +>r2 : Symbol(r2, Decl(mappedTypeInferenceAliasSubstitution.ts, 10, 5)) |
| 50 | +>g : Symbol(g, Decl(mappedTypeInferenceAliasSubstitution.ts, 9, 5)) |
| 51 | +>v : Symbol(v, Decl(mappedTypeInferenceAliasSubstitution.ts, 2, 5)) |
| 52 | + |
0 commit comments