|
| 1 | +//// [tests/cases/compiler/homomorphicMappedTypeNesting.ts] //// |
| 2 | + |
| 3 | +=== homomorphicMappedTypeNesting.ts === |
| 4 | +// Repro from #58060 |
| 5 | + |
| 6 | +type Box<T extends string> = { v: T }; |
| 7 | +>Box : Symbol(Box, Decl(homomorphicMappedTypeNesting.ts, 0, 0)) |
| 8 | +>T : Symbol(T, Decl(homomorphicMappedTypeNesting.ts, 2, 9)) |
| 9 | +>v : Symbol(v, Decl(homomorphicMappedTypeNesting.ts, 2, 30)) |
| 10 | +>T : Symbol(T, Decl(homomorphicMappedTypeNesting.ts, 2, 9)) |
| 11 | + |
| 12 | +type Test<T extends string[]> = T |
| 13 | +>Test : Symbol(Test, Decl(homomorphicMappedTypeNesting.ts, 2, 38)) |
| 14 | +>T : Symbol(T, Decl(homomorphicMappedTypeNesting.ts, 4, 10)) |
| 15 | +>T : Symbol(T, Decl(homomorphicMappedTypeNesting.ts, 4, 10)) |
| 16 | + |
| 17 | +type UnboxArray<T> = { |
| 18 | +>UnboxArray : Symbol(UnboxArray, Decl(homomorphicMappedTypeNesting.ts, 4, 33)) |
| 19 | +>T : Symbol(T, Decl(homomorphicMappedTypeNesting.ts, 6, 16)) |
| 20 | + |
| 21 | + [K in keyof T]: T[K] extends Box<infer R> ? R : never; |
| 22 | +>K : Symbol(K, Decl(homomorphicMappedTypeNesting.ts, 7, 5)) |
| 23 | +>T : Symbol(T, Decl(homomorphicMappedTypeNesting.ts, 6, 16)) |
| 24 | +>T : Symbol(T, Decl(homomorphicMappedTypeNesting.ts, 6, 16)) |
| 25 | +>K : Symbol(K, Decl(homomorphicMappedTypeNesting.ts, 7, 5)) |
| 26 | +>Box : Symbol(Box, Decl(homomorphicMappedTypeNesting.ts, 0, 0)) |
| 27 | +>R : Symbol(R, Decl(homomorphicMappedTypeNesting.ts, 7, 42)) |
| 28 | +>R : Symbol(R, Decl(homomorphicMappedTypeNesting.ts, 7, 42)) |
| 29 | + |
| 30 | +}; |
| 31 | + |
| 32 | +type Identity<T> = { [K in keyof T]: T[K] }; |
| 33 | +>Identity : Symbol(Identity, Decl(homomorphicMappedTypeNesting.ts, 8, 2)) |
| 34 | +>T : Symbol(T, Decl(homomorphicMappedTypeNesting.ts, 10, 14)) |
| 35 | +>K : Symbol(K, Decl(homomorphicMappedTypeNesting.ts, 10, 22)) |
| 36 | +>T : Symbol(T, Decl(homomorphicMappedTypeNesting.ts, 10, 14)) |
| 37 | +>T : Symbol(T, Decl(homomorphicMappedTypeNesting.ts, 10, 14)) |
| 38 | +>K : Symbol(K, Decl(homomorphicMappedTypeNesting.ts, 10, 22)) |
| 39 | + |
| 40 | +declare function fnBad<T extends Array<Box<string>>>(...args: T): Test<Identity<UnboxArray<T>>>; |
| 41 | +>fnBad : Symbol(fnBad, Decl(homomorphicMappedTypeNesting.ts, 10, 44)) |
| 42 | +>T : Symbol(T, Decl(homomorphicMappedTypeNesting.ts, 12, 23)) |
| 43 | +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) |
| 44 | +>Box : Symbol(Box, Decl(homomorphicMappedTypeNesting.ts, 0, 0)) |
| 45 | +>args : Symbol(args, Decl(homomorphicMappedTypeNesting.ts, 12, 53)) |
| 46 | +>T : Symbol(T, Decl(homomorphicMappedTypeNesting.ts, 12, 23)) |
| 47 | +>Test : Symbol(Test, Decl(homomorphicMappedTypeNesting.ts, 2, 38)) |
| 48 | +>Identity : Symbol(Identity, Decl(homomorphicMappedTypeNesting.ts, 8, 2)) |
| 49 | +>UnboxArray : Symbol(UnboxArray, Decl(homomorphicMappedTypeNesting.ts, 4, 33)) |
| 50 | +>T : Symbol(T, Decl(homomorphicMappedTypeNesting.ts, 12, 23)) |
| 51 | + |
0 commit comments