|
| 1 | +=== tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts === |
| 2 | +// Repros from #23800 |
| 3 | + |
| 4 | +type A<T, V> = { [P in keyof T]: T[P] extends V ? 1 : 0; }; |
| 5 | +>A : Symbol(A, Decl(nonPrimitiveAndTypeVariables.ts, 0, 0)) |
| 6 | +>T : Symbol(T, Decl(nonPrimitiveAndTypeVariables.ts, 2, 7)) |
| 7 | +>V : Symbol(V, Decl(nonPrimitiveAndTypeVariables.ts, 2, 9)) |
| 8 | +>P : Symbol(P, Decl(nonPrimitiveAndTypeVariables.ts, 2, 18)) |
| 9 | +>T : Symbol(T, Decl(nonPrimitiveAndTypeVariables.ts, 2, 7)) |
| 10 | +>T : Symbol(T, Decl(nonPrimitiveAndTypeVariables.ts, 2, 7)) |
| 11 | +>P : Symbol(P, Decl(nonPrimitiveAndTypeVariables.ts, 2, 18)) |
| 12 | +>V : Symbol(V, Decl(nonPrimitiveAndTypeVariables.ts, 2, 9)) |
| 13 | + |
| 14 | +type B<T, V> = { [P in keyof T]: T[P] extends V | object ? 1 : 0; }; |
| 15 | +>B : Symbol(B, Decl(nonPrimitiveAndTypeVariables.ts, 2, 59)) |
| 16 | +>T : Symbol(T, Decl(nonPrimitiveAndTypeVariables.ts, 3, 7)) |
| 17 | +>V : Symbol(V, Decl(nonPrimitiveAndTypeVariables.ts, 3, 9)) |
| 18 | +>P : Symbol(P, Decl(nonPrimitiveAndTypeVariables.ts, 3, 18)) |
| 19 | +>T : Symbol(T, Decl(nonPrimitiveAndTypeVariables.ts, 3, 7)) |
| 20 | +>T : Symbol(T, Decl(nonPrimitiveAndTypeVariables.ts, 3, 7)) |
| 21 | +>P : Symbol(P, Decl(nonPrimitiveAndTypeVariables.ts, 3, 18)) |
| 22 | +>V : Symbol(V, Decl(nonPrimitiveAndTypeVariables.ts, 3, 9)) |
| 23 | + |
| 24 | +let a: A<{ a: 0 | 1 }, 0> = { a: 0 }; |
| 25 | +>a : Symbol(a, Decl(nonPrimitiveAndTypeVariables.ts, 5, 3)) |
| 26 | +>A : Symbol(A, Decl(nonPrimitiveAndTypeVariables.ts, 0, 0)) |
| 27 | +>a : Symbol(a, Decl(nonPrimitiveAndTypeVariables.ts, 5, 10)) |
| 28 | +>a : Symbol(a, Decl(nonPrimitiveAndTypeVariables.ts, 5, 29)) |
| 29 | + |
| 30 | +let b: B<{ a: 0 | 1 }, 0> = { a: 0 }; |
| 31 | +>b : Symbol(b, Decl(nonPrimitiveAndTypeVariables.ts, 6, 3)) |
| 32 | +>B : Symbol(B, Decl(nonPrimitiveAndTypeVariables.ts, 2, 59)) |
| 33 | +>a : Symbol(a, Decl(nonPrimitiveAndTypeVariables.ts, 6, 10)) |
| 34 | +>a : Symbol(a, Decl(nonPrimitiveAndTypeVariables.ts, 6, 29)) |
| 35 | + |
| 36 | +function foo<T, U>(x: T) { |
| 37 | +>foo : Symbol(foo, Decl(nonPrimitiveAndTypeVariables.ts, 6, 37)) |
| 38 | +>T : Symbol(T, Decl(nonPrimitiveAndTypeVariables.ts, 8, 13)) |
| 39 | +>U : Symbol(U, Decl(nonPrimitiveAndTypeVariables.ts, 8, 15)) |
| 40 | +>x : Symbol(x, Decl(nonPrimitiveAndTypeVariables.ts, 8, 19)) |
| 41 | +>T : Symbol(T, Decl(nonPrimitiveAndTypeVariables.ts, 8, 13)) |
| 42 | + |
| 43 | + let a: object = x; // Error |
| 44 | +>a : Symbol(a, Decl(nonPrimitiveAndTypeVariables.ts, 9, 7)) |
| 45 | +>x : Symbol(x, Decl(nonPrimitiveAndTypeVariables.ts, 8, 19)) |
| 46 | + |
| 47 | + let b: U | object = x; // Error |
| 48 | +>b : Symbol(b, Decl(nonPrimitiveAndTypeVariables.ts, 10, 7)) |
| 49 | +>U : Symbol(U, Decl(nonPrimitiveAndTypeVariables.ts, 8, 15)) |
| 50 | +>x : Symbol(x, Decl(nonPrimitiveAndTypeVariables.ts, 8, 19)) |
| 51 | +} |
| 52 | + |
0 commit comments