|
| 1 | +=== tests/cases/conformance/types/mapped/mappedTypes1.ts === |
| 2 | + |
| 3 | +type Item = { a: string, b: number, c: boolean }; |
| 4 | +>Item : Symbol(Item, Decl(mappedTypes1.ts, 0, 0)) |
| 5 | +>a : Symbol(a, Decl(mappedTypes1.ts, 1, 13)) |
| 6 | +>b : Symbol(b, Decl(mappedTypes1.ts, 1, 24)) |
| 7 | +>c : Symbol(c, Decl(mappedTypes1.ts, 1, 35)) |
| 8 | + |
| 9 | +type T00 = { [P in "x" | "y"]: number }; |
| 10 | +>T00 : Symbol(T00, Decl(mappedTypes1.ts, 1, 49)) |
| 11 | +>P : Symbol(P, Decl(mappedTypes1.ts, 3, 14)) |
| 12 | + |
| 13 | +type T01 = { [P in "x" | "y"]: P }; |
| 14 | +>T01 : Symbol(T01, Decl(mappedTypes1.ts, 3, 40)) |
| 15 | +>P : Symbol(P, Decl(mappedTypes1.ts, 4, 14)) |
| 16 | +>P : Symbol(P, Decl(mappedTypes1.ts, 4, 14)) |
| 17 | + |
| 18 | +type T02 = { [P in "a" | "b"]: Item[P]; } |
| 19 | +>T02 : Symbol(T02, Decl(mappedTypes1.ts, 4, 35)) |
| 20 | +>P : Symbol(P, Decl(mappedTypes1.ts, 5, 14)) |
| 21 | +>Item : Symbol(Item, Decl(mappedTypes1.ts, 0, 0)) |
| 22 | +>P : Symbol(P, Decl(mappedTypes1.ts, 5, 14)) |
| 23 | + |
| 24 | +type T03 = { [P in keyof Item]: Date }; |
| 25 | +>T03 : Symbol(T03, Decl(mappedTypes1.ts, 5, 41)) |
| 26 | +>P : Symbol(P, Decl(mappedTypes1.ts, 6, 14)) |
| 27 | +>Item : Symbol(Item, Decl(mappedTypes1.ts, 0, 0)) |
| 28 | +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) |
| 29 | + |
| 30 | +type T10 = { [P in keyof Item]: Item[P] }; |
| 31 | +>T10 : Symbol(T10, Decl(mappedTypes1.ts, 6, 39)) |
| 32 | +>P : Symbol(P, Decl(mappedTypes1.ts, 8, 14)) |
| 33 | +>Item : Symbol(Item, Decl(mappedTypes1.ts, 0, 0)) |
| 34 | +>Item : Symbol(Item, Decl(mappedTypes1.ts, 0, 0)) |
| 35 | +>P : Symbol(P, Decl(mappedTypes1.ts, 8, 14)) |
| 36 | + |
| 37 | +type T11 = { [P in keyof Item]?: Item[P] }; |
| 38 | +>T11 : Symbol(T11, Decl(mappedTypes1.ts, 8, 42)) |
| 39 | +>P : Symbol(P, Decl(mappedTypes1.ts, 9, 14)) |
| 40 | +>Item : Symbol(Item, Decl(mappedTypes1.ts, 0, 0)) |
| 41 | +>Item : Symbol(Item, Decl(mappedTypes1.ts, 0, 0)) |
| 42 | +>P : Symbol(P, Decl(mappedTypes1.ts, 9, 14)) |
| 43 | + |
| 44 | +type T12 = { readonly [P in keyof Item]: Item[P] }; |
| 45 | +>T12 : Symbol(T12, Decl(mappedTypes1.ts, 9, 43)) |
| 46 | +>P : Symbol(P, Decl(mappedTypes1.ts, 10, 23)) |
| 47 | +>Item : Symbol(Item, Decl(mappedTypes1.ts, 0, 0)) |
| 48 | +>Item : Symbol(Item, Decl(mappedTypes1.ts, 0, 0)) |
| 49 | +>P : Symbol(P, Decl(mappedTypes1.ts, 10, 23)) |
| 50 | + |
| 51 | +type T13 = { readonly [P in keyof Item]?: Item[P] }; |
| 52 | +>T13 : Symbol(T13, Decl(mappedTypes1.ts, 10, 51)) |
| 53 | +>P : Symbol(P, Decl(mappedTypes1.ts, 11, 23)) |
| 54 | +>Item : Symbol(Item, Decl(mappedTypes1.ts, 0, 0)) |
| 55 | +>Item : Symbol(Item, Decl(mappedTypes1.ts, 0, 0)) |
| 56 | +>P : Symbol(P, Decl(mappedTypes1.ts, 11, 23)) |
| 57 | + |
| 58 | +type T20 = { [P in keyof Item]: Item[P] | null }; |
| 59 | +>T20 : Symbol(T20, Decl(mappedTypes1.ts, 11, 52)) |
| 60 | +>P : Symbol(P, Decl(mappedTypes1.ts, 13, 14)) |
| 61 | +>Item : Symbol(Item, Decl(mappedTypes1.ts, 0, 0)) |
| 62 | +>Item : Symbol(Item, Decl(mappedTypes1.ts, 0, 0)) |
| 63 | +>P : Symbol(P, Decl(mappedTypes1.ts, 13, 14)) |
| 64 | + |
| 65 | +type T21 = { [P in keyof Item]: Array<Item[P]> }; |
| 66 | +>T21 : Symbol(T21, Decl(mappedTypes1.ts, 13, 49)) |
| 67 | +>P : Symbol(P, Decl(mappedTypes1.ts, 14, 14)) |
| 68 | +>Item : Symbol(Item, Decl(mappedTypes1.ts, 0, 0)) |
| 69 | +>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) |
| 70 | +>Item : Symbol(Item, Decl(mappedTypes1.ts, 0, 0)) |
| 71 | +>P : Symbol(P, Decl(mappedTypes1.ts, 14, 14)) |
| 72 | + |
| 73 | +type T30 = { [P in keyof any]: void }; |
| 74 | +>T30 : Symbol(T30, Decl(mappedTypes1.ts, 14, 49)) |
| 75 | +>P : Symbol(P, Decl(mappedTypes1.ts, 16, 14)) |
| 76 | + |
| 77 | +type T31 = { [P in keyof string]: void }; |
| 78 | +>T31 : Symbol(T31, Decl(mappedTypes1.ts, 16, 38)) |
| 79 | +>P : Symbol(P, Decl(mappedTypes1.ts, 17, 14)) |
| 80 | + |
| 81 | +type T32 = { [P in keyof number]: void }; |
| 82 | +>T32 : Symbol(T32, Decl(mappedTypes1.ts, 17, 41)) |
| 83 | +>P : Symbol(P, Decl(mappedTypes1.ts, 18, 14)) |
| 84 | + |
| 85 | +type T33 = { [P in keyof boolean]: void }; |
| 86 | +>T33 : Symbol(T33, Decl(mappedTypes1.ts, 18, 41)) |
| 87 | +>P : Symbol(P, Decl(mappedTypes1.ts, 19, 14)) |
| 88 | + |
| 89 | +type T34 = { [P in keyof undefined]: void }; |
| 90 | +>T34 : Symbol(T34, Decl(mappedTypes1.ts, 19, 42)) |
| 91 | +>P : Symbol(P, Decl(mappedTypes1.ts, 20, 14)) |
| 92 | + |
| 93 | +type T35 = { [P in keyof null]: void }; |
| 94 | +>T35 : Symbol(T35, Decl(mappedTypes1.ts, 20, 44)) |
| 95 | +>P : Symbol(P, Decl(mappedTypes1.ts, 21, 14)) |
| 96 | + |
| 97 | +type T36 = { [P in keyof void]: void }; |
| 98 | +>T36 : Symbol(T36, Decl(mappedTypes1.ts, 21, 39)) |
| 99 | +>P : Symbol(P, Decl(mappedTypes1.ts, 22, 14)) |
| 100 | + |
| 101 | +type T37 = { [P in keyof symbol]: void }; |
| 102 | +>T37 : Symbol(T37, Decl(mappedTypes1.ts, 22, 39)) |
| 103 | +>P : Symbol(P, Decl(mappedTypes1.ts, 23, 14)) |
| 104 | + |
| 105 | +type T38 = { [P in keyof never]: void }; |
| 106 | +>T38 : Symbol(T38, Decl(mappedTypes1.ts, 23, 41)) |
| 107 | +>P : Symbol(P, Decl(mappedTypes1.ts, 24, 14)) |
| 108 | + |
| 109 | +declare function f1<T1>(): { [P in keyof T1]: void }; |
| 110 | +>f1 : Symbol(f1, Decl(mappedTypes1.ts, 24, 40)) |
| 111 | +>T1 : Symbol(T1, Decl(mappedTypes1.ts, 26, 20)) |
| 112 | +>P : Symbol(P, Decl(mappedTypes1.ts, 26, 30)) |
| 113 | +>T1 : Symbol(T1, Decl(mappedTypes1.ts, 26, 20)) |
| 114 | + |
| 115 | +declare function f2<T1 extends string>(): { [P in keyof T1]: void }; |
| 116 | +>f2 : Symbol(f2, Decl(mappedTypes1.ts, 26, 53)) |
| 117 | +>T1 : Symbol(T1, Decl(mappedTypes1.ts, 27, 20)) |
| 118 | +>P : Symbol(P, Decl(mappedTypes1.ts, 27, 45)) |
| 119 | +>T1 : Symbol(T1, Decl(mappedTypes1.ts, 27, 20)) |
| 120 | + |
| 121 | +declare function f3<T1 extends number>(): { [P in keyof T1]: void }; |
| 122 | +>f3 : Symbol(f3, Decl(mappedTypes1.ts, 27, 68)) |
| 123 | +>T1 : Symbol(T1, Decl(mappedTypes1.ts, 28, 20)) |
| 124 | +>P : Symbol(P, Decl(mappedTypes1.ts, 28, 45)) |
| 125 | +>T1 : Symbol(T1, Decl(mappedTypes1.ts, 28, 20)) |
| 126 | + |
| 127 | +let x1 = f1(); |
| 128 | +>x1 : Symbol(x1, Decl(mappedTypes1.ts, 30, 3)) |
| 129 | +>f1 : Symbol(f1, Decl(mappedTypes1.ts, 24, 40)) |
| 130 | + |
| 131 | +let x2 = f2(); |
| 132 | +>x2 : Symbol(x2, Decl(mappedTypes1.ts, 31, 3)) |
| 133 | +>f2 : Symbol(f2, Decl(mappedTypes1.ts, 26, 53)) |
| 134 | + |
| 135 | +let x3 = f3(); |
| 136 | +>x3 : Symbol(x3, Decl(mappedTypes1.ts, 32, 3)) |
| 137 | +>f3 : Symbol(f3, Decl(mappedTypes1.ts, 27, 68)) |
| 138 | + |
0 commit comments