|
| 1 | +=== tests/cases/compiler/inferRestArgumentsMappedTuple.ts === |
| 2 | +type MyMappedType<Primitive extends any> = { |
| 3 | +>MyMappedType : Symbol(MyMappedType, Decl(inferRestArgumentsMappedTuple.ts, 0, 0)) |
| 4 | +>Primitive : Symbol(Primitive, Decl(inferRestArgumentsMappedTuple.ts, 0, 18)) |
| 5 | + |
| 6 | + primitive: Primitive; |
| 7 | +>primitive : Symbol(primitive, Decl(inferRestArgumentsMappedTuple.ts, 0, 44)) |
| 8 | +>Primitive : Symbol(Primitive, Decl(inferRestArgumentsMappedTuple.ts, 0, 18)) |
| 9 | + |
| 10 | +}; |
| 11 | + |
| 12 | +type TupleMapperOld<Tuple extends any[]> = { |
| 13 | +>TupleMapperOld : Symbol(TupleMapperOld, Decl(inferRestArgumentsMappedTuple.ts, 2, 2)) |
| 14 | +>Tuple : Symbol(Tuple, Decl(inferRestArgumentsMappedTuple.ts, 4, 20)) |
| 15 | + |
| 16 | + [Key in keyof Tuple]: Tuple[Key] extends Tuple[number] ? MyMappedType<Tuple[Key]> : never; |
| 17 | +>Key : Symbol(Key, Decl(inferRestArgumentsMappedTuple.ts, 5, 2)) |
| 18 | +>Tuple : Symbol(Tuple, Decl(inferRestArgumentsMappedTuple.ts, 4, 20)) |
| 19 | +>Tuple : Symbol(Tuple, Decl(inferRestArgumentsMappedTuple.ts, 4, 20)) |
| 20 | +>Key : Symbol(Key, Decl(inferRestArgumentsMappedTuple.ts, 5, 2)) |
| 21 | +>Tuple : Symbol(Tuple, Decl(inferRestArgumentsMappedTuple.ts, 4, 20)) |
| 22 | +>MyMappedType : Symbol(MyMappedType, Decl(inferRestArgumentsMappedTuple.ts, 0, 0)) |
| 23 | +>Tuple : Symbol(Tuple, Decl(inferRestArgumentsMappedTuple.ts, 4, 20)) |
| 24 | +>Key : Symbol(Key, Decl(inferRestArgumentsMappedTuple.ts, 5, 2)) |
| 25 | + |
| 26 | +}; |
| 27 | + |
| 28 | +type MyMappedTupleOld = TupleMapperOld<[string, number]>; // [MyMappedType<string>, MyMappedType<number>] |
| 29 | +>MyMappedTupleOld : Symbol(MyMappedTupleOld, Decl(inferRestArgumentsMappedTuple.ts, 6, 2)) |
| 30 | +>TupleMapperOld : Symbol(TupleMapperOld, Decl(inferRestArgumentsMappedTuple.ts, 2, 2)) |
| 31 | + |
| 32 | +declare function extractPrimitivesOld<Tuple extends any[]>(...mappedTypes: TupleMapperOld<Tuple>): Tuple; |
| 33 | +>extractPrimitivesOld : Symbol(extractPrimitivesOld, Decl(inferRestArgumentsMappedTuple.ts, 8, 57)) |
| 34 | +>Tuple : Symbol(Tuple, Decl(inferRestArgumentsMappedTuple.ts, 10, 38)) |
| 35 | +>mappedTypes : Symbol(mappedTypes, Decl(inferRestArgumentsMappedTuple.ts, 10, 59)) |
| 36 | +>TupleMapperOld : Symbol(TupleMapperOld, Decl(inferRestArgumentsMappedTuple.ts, 2, 2)) |
| 37 | +>Tuple : Symbol(Tuple, Decl(inferRestArgumentsMappedTuple.ts, 10, 38)) |
| 38 | +>Tuple : Symbol(Tuple, Decl(inferRestArgumentsMappedTuple.ts, 10, 38)) |
| 39 | + |
| 40 | +const myPrimitiveTupleOld: [string, number] = extractPrimitivesOld({ primitive: "" }, { primitive: 0 }); |
| 41 | +>myPrimitiveTupleOld : Symbol(myPrimitiveTupleOld, Decl(inferRestArgumentsMappedTuple.ts, 12, 5)) |
| 42 | +>extractPrimitivesOld : Symbol(extractPrimitivesOld, Decl(inferRestArgumentsMappedTuple.ts, 8, 57)) |
| 43 | +>primitive : Symbol(primitive, Decl(inferRestArgumentsMappedTuple.ts, 12, 68)) |
| 44 | +>primitive : Symbol(primitive, Decl(inferRestArgumentsMappedTuple.ts, 12, 87)) |
| 45 | + |
| 46 | +type TupleMapperNew<Tuple extends any[]> = { |
| 47 | +>TupleMapperNew : Symbol(TupleMapperNew, Decl(inferRestArgumentsMappedTuple.ts, 12, 104)) |
| 48 | +>Tuple : Symbol(Tuple, Decl(inferRestArgumentsMappedTuple.ts, 14, 20)) |
| 49 | + |
| 50 | + [Key in keyof Tuple]: MyMappedType<Tuple[Key]>; |
| 51 | +>Key : Symbol(Key, Decl(inferRestArgumentsMappedTuple.ts, 15, 2)) |
| 52 | +>Tuple : Symbol(Tuple, Decl(inferRestArgumentsMappedTuple.ts, 14, 20)) |
| 53 | +>MyMappedType : Symbol(MyMappedType, Decl(inferRestArgumentsMappedTuple.ts, 0, 0)) |
| 54 | +>Tuple : Symbol(Tuple, Decl(inferRestArgumentsMappedTuple.ts, 14, 20)) |
| 55 | +>Key : Symbol(Key, Decl(inferRestArgumentsMappedTuple.ts, 15, 2)) |
| 56 | + |
| 57 | +}; |
| 58 | + |
| 59 | +type MyMappedTupleNew = TupleMapperNew<[string, number]>; |
| 60 | +>MyMappedTupleNew : Symbol(MyMappedTupleNew, Decl(inferRestArgumentsMappedTuple.ts, 16, 2)) |
| 61 | +>TupleMapperNew : Symbol(TupleMapperNew, Decl(inferRestArgumentsMappedTuple.ts, 12, 104)) |
| 62 | + |
| 63 | +declare function extractPrimitivesNew<Tuple extends any[]>(...mappedTypes: TupleMapperNew<Tuple>): Tuple; |
| 64 | +>extractPrimitivesNew : Symbol(extractPrimitivesNew, Decl(inferRestArgumentsMappedTuple.ts, 18, 57)) |
| 65 | +>Tuple : Symbol(Tuple, Decl(inferRestArgumentsMappedTuple.ts, 20, 38)) |
| 66 | +>mappedTypes : Symbol(mappedTypes, Decl(inferRestArgumentsMappedTuple.ts, 20, 59)) |
| 67 | +>TupleMapperNew : Symbol(TupleMapperNew, Decl(inferRestArgumentsMappedTuple.ts, 12, 104)) |
| 68 | +>Tuple : Symbol(Tuple, Decl(inferRestArgumentsMappedTuple.ts, 20, 38)) |
| 69 | +>Tuple : Symbol(Tuple, Decl(inferRestArgumentsMappedTuple.ts, 20, 38)) |
| 70 | + |
| 71 | +const myPrimitiveTupleNew: [string, number] = extractPrimitivesNew({ primitive: "" }, { primitive: 0 }); |
| 72 | +>myPrimitiveTupleNew : Symbol(myPrimitiveTupleNew, Decl(inferRestArgumentsMappedTuple.ts, 22, 5)) |
| 73 | +>extractPrimitivesNew : Symbol(extractPrimitivesNew, Decl(inferRestArgumentsMappedTuple.ts, 18, 57)) |
| 74 | +>primitive : Symbol(primitive, Decl(inferRestArgumentsMappedTuple.ts, 22, 68)) |
| 75 | +>primitive : Symbol(primitive, Decl(inferRestArgumentsMappedTuple.ts, 22, 87)) |
| 76 | + |
0 commit comments