|
| 1 | +//// [tests/cases/compiler/mappedArrayTupleIntersections.ts] //// |
| 2 | + |
| 3 | +=== mappedArrayTupleIntersections.ts === |
| 4 | +type Box<T> = { value: T }; |
| 5 | +>Box : Symbol(Box, Decl(mappedArrayTupleIntersections.ts, 0, 0)) |
| 6 | +>T : Symbol(T, Decl(mappedArrayTupleIntersections.ts, 0, 9)) |
| 7 | +>value : Symbol(value, Decl(mappedArrayTupleIntersections.ts, 0, 15)) |
| 8 | +>T : Symbol(T, Decl(mappedArrayTupleIntersections.ts, 0, 9)) |
| 9 | + |
| 10 | +type Boxify<T> = { [K in keyof T]: Box<T[K]> }; |
| 11 | +>Boxify : Symbol(Boxify, Decl(mappedArrayTupleIntersections.ts, 0, 27)) |
| 12 | +>T : Symbol(T, Decl(mappedArrayTupleIntersections.ts, 1, 12)) |
| 13 | +>K : Symbol(K, Decl(mappedArrayTupleIntersections.ts, 1, 20)) |
| 14 | +>T : Symbol(T, Decl(mappedArrayTupleIntersections.ts, 1, 12)) |
| 15 | +>Box : Symbol(Box, Decl(mappedArrayTupleIntersections.ts, 0, 0)) |
| 16 | +>T : Symbol(T, Decl(mappedArrayTupleIntersections.ts, 1, 12)) |
| 17 | +>K : Symbol(K, Decl(mappedArrayTupleIntersections.ts, 1, 20)) |
| 18 | + |
| 19 | +type T1 = Boxify<string[]>; |
| 20 | +>T1 : Symbol(T1, Decl(mappedArrayTupleIntersections.ts, 1, 47)) |
| 21 | +>Boxify : Symbol(Boxify, Decl(mappedArrayTupleIntersections.ts, 0, 27)) |
| 22 | + |
| 23 | +type T2 = Boxify<[string, string]>; |
| 24 | +>T2 : Symbol(T2, Decl(mappedArrayTupleIntersections.ts, 3, 27)) |
| 25 | +>Boxify : Symbol(Boxify, Decl(mappedArrayTupleIntersections.ts, 0, 27)) |
| 26 | + |
| 27 | +type T3 = Boxify<string[] & unknown[]>; |
| 28 | +>T3 : Symbol(T3, Decl(mappedArrayTupleIntersections.ts, 4, 35)) |
| 29 | +>Boxify : Symbol(Boxify, Decl(mappedArrayTupleIntersections.ts, 0, 27)) |
| 30 | + |
| 31 | +type T4 = Boxify<string[] & [string, string]>; |
| 32 | +>T4 : Symbol(T4, Decl(mappedArrayTupleIntersections.ts, 5, 39)) |
| 33 | +>Boxify : Symbol(Boxify, Decl(mappedArrayTupleIntersections.ts, 0, 27)) |
| 34 | + |
| 35 | +type T5 = Boxify<string[] & { x: string }>; |
| 36 | +>T5 : Symbol(T5, Decl(mappedArrayTupleIntersections.ts, 6, 46)) |
| 37 | +>Boxify : Symbol(Boxify, Decl(mappedArrayTupleIntersections.ts, 0, 27)) |
| 38 | +>x : Symbol(x, Decl(mappedArrayTupleIntersections.ts, 7, 29)) |
| 39 | + |
| 40 | +// https://github.com/microsoft/TypeScript/issues/57744 |
| 41 | + |
| 42 | +type MustBeArray<T extends any[]> = T; |
| 43 | +>MustBeArray : Symbol(MustBeArray, Decl(mappedArrayTupleIntersections.ts, 7, 43)) |
| 44 | +>T : Symbol(T, Decl(mappedArrayTupleIntersections.ts, 11, 17)) |
| 45 | +>T : Symbol(T, Decl(mappedArrayTupleIntersections.ts, 11, 17)) |
| 46 | + |
| 47 | +type Hmm<T extends any[]> = T extends number[] ? |
| 48 | +>Hmm : Symbol(Hmm, Decl(mappedArrayTupleIntersections.ts, 11, 38)) |
| 49 | +>T : Symbol(T, Decl(mappedArrayTupleIntersections.ts, 13, 9)) |
| 50 | +>T : Symbol(T, Decl(mappedArrayTupleIntersections.ts, 13, 9)) |
| 51 | + |
| 52 | + MustBeArray<{ [I in keyof T]: 1 }> : |
| 53 | +>MustBeArray : Symbol(MustBeArray, Decl(mappedArrayTupleIntersections.ts, 7, 43)) |
| 54 | +>I : Symbol(I, Decl(mappedArrayTupleIntersections.ts, 14, 19)) |
| 55 | +>T : Symbol(T, Decl(mappedArrayTupleIntersections.ts, 13, 9)) |
| 56 | + |
| 57 | + never; |
| 58 | + |
| 59 | +type X = Hmm<[3, 4, 5]>; |
| 60 | +>X : Symbol(X, Decl(mappedArrayTupleIntersections.ts, 15, 10)) |
| 61 | +>Hmm : Symbol(Hmm, Decl(mappedArrayTupleIntersections.ts, 11, 38)) |
| 62 | + |
0 commit comments