1
1
=== tests/cases/conformance/types/mapped/mappedTypesArraysTuples.ts ===
2
2
type Box<T> = { value: T };
3
3
>Box : Box<T>
4
- >T : T
5
4
>value : T
6
- >T : T
7
5
8
6
type Boxified<T> = { [P in keyof T]: Box<T[P]> };
9
7
>Boxified : Boxified<T>
10
- >T : T
11
- >P : P
12
- >T : T
13
- >Box : Box<T>
14
- >T : T
15
- >P : P
16
8
17
9
type T00 = Boxified<[number, string?, ...boolean[]]>;
18
10
>T00 : [Box<number>, Box<string | undefined>?, ...Box<boolean>[]]
19
- >Boxified : Boxified<T>
20
11
21
12
type T01 = Partial<[number, string?, ...boolean[]]>;
22
13
>T01 : [(number | undefined)?, (string | undefined)?, ...(boolean | undefined)[]]
23
- >Partial : Partial<T>
24
14
25
15
type T02 = Required<[number, string?, ...boolean[]]>;
26
16
>T02 : [number, string, ...boolean[]]
27
- >Required : Required<T>
28
17
29
18
type T10 = Boxified<string[]>;
30
19
>T10 : Box<string>[]
31
- >Boxified : Boxified<T>
32
20
33
21
type T11 = Partial<string[]>;
34
22
>T11 : (string | undefined)[]
35
- >Partial : Partial<T>
36
23
37
24
type T12 = Required<string[]>;
38
25
>T12 : string[]
39
- >Required : Required<T>
40
26
41
27
type T13 = Boxified<ReadonlyArray<string>>;
42
28
>T13 : ReadonlyArray<Box<string>>
43
- >Boxified : Boxified<T>
44
- >ReadonlyArray : ReadonlyArray<T>
45
29
46
30
type T14 = Partial<ReadonlyArray<string>>;
47
31
>T14 : ReadonlyArray<string | undefined>
48
- >Partial : Partial<T>
49
- >ReadonlyArray : ReadonlyArray<T>
50
32
51
33
type T15 = Required<ReadonlyArray<string>>;
52
34
>T15 : ReadonlyArray<string>
53
- >Required : Required<T>
54
- >ReadonlyArray : ReadonlyArray<T>
55
35
56
36
type T20 = Boxified<(string | undefined)[]>;
57
37
>T20 : Box<string | undefined>[]
58
- >Boxified : Boxified<T>
59
38
60
39
type T21 = Partial<(string | undefined)[]>;
61
40
>T21 : (string | undefined)[]
62
- >Partial : Partial<T>
63
41
64
42
type T22 = Required<(string | undefined)[]>;
65
43
>T22 : string[]
66
- >Required : Required<T>
67
44
68
45
type T23 = Boxified<ReadonlyArray<string | undefined>>;
69
46
>T23 : ReadonlyArray<Box<string | undefined>>
70
- >Boxified : Boxified<T>
71
- >ReadonlyArray : ReadonlyArray<T>
72
47
73
48
type T24 = Partial<ReadonlyArray<string | undefined>>;
74
49
>T24 : ReadonlyArray<string | undefined>
75
- >Partial : Partial<T>
76
- >ReadonlyArray : ReadonlyArray<T>
77
50
78
51
type T25 = Required<ReadonlyArray<string | undefined>>;
79
52
>T25 : ReadonlyArray<string>
80
- >Required : Required<T>
81
- >ReadonlyArray : ReadonlyArray<T>
82
53
83
54
type T30 = Boxified<Partial<string[]>>;
84
55
>T30 : Box<string | undefined>[]
85
- >Boxified : Boxified<T>
86
- >Partial : Partial<T>
87
56
88
57
type T31 = Partial<Boxified<string[]>>;
89
58
>T31 : (Box<string> | undefined)[]
90
- >Partial : Partial<T>
91
- >Boxified : Boxified<T>
92
59
93
60
type A = { a: string };
94
61
>A : A
@@ -100,27 +67,13 @@ type B = { b: string };
100
67
101
68
type T40 = Boxified<A | A[] | ReadonlyArray<A> | [A, B] | string | string[]>;
102
69
>T40 : string | Box<string>[] | Boxified<A> | Box<A>[] | ReadonlyArray<Box<A>> | [Box<A>, Box<B>]
103
- >Boxified : Boxified<T>
104
- >A : A
105
- >A : A
106
- >ReadonlyArray : ReadonlyArray<T>
107
- >A : A
108
- >A : A
109
- >B : B
110
70
111
71
declare function unboxify<T>(x: Boxified<T>): T;
112
72
>unboxify : <T>(x: Boxified<T>) => T
113
- >T : T
114
73
>x : Boxified<T>
115
- >Boxified : Boxified<T>
116
- >T : T
117
- >T : T
118
74
119
75
declare let x10: [Box<number>, Box<string>, ...Box<boolean>[]];
120
76
>x10 : [Box<number>, Box<string>, ...Box<boolean>[]]
121
- >Box : Box<T>
122
- >Box : Box<T>
123
- >Box : Box<T>
124
77
125
78
let y10 = unboxify(x10);
126
79
>y10 : [number, string, ...boolean[]]
@@ -130,7 +83,6 @@ let y10 = unboxify(x10);
130
83
131
84
declare let x11: Box<number>[];
132
85
>x11 : Box<number>[]
133
- >Box : Box<T>
134
86
135
87
let y11 = unboxify(x11);
136
88
>y11 : number[]
@@ -141,9 +93,7 @@ let y11 = unboxify(x11);
141
93
declare let x12: { a: Box<number>, b: Box<string[]> };
142
94
>x12 : { a: Box<number>; b: Box<string[]>; }
143
95
>a : Box<number>
144
- >Box : Box<T>
145
96
>b : Box<string[]>
146
- >Box : Box<T>
147
97
148
98
let y12 = unboxify(x12);
149
99
>y12 : { a: number; b: string[]; }
@@ -153,11 +103,7 @@ let y12 = unboxify(x12);
153
103
154
104
declare function nonpartial<T>(x: Partial<T>): T;
155
105
>nonpartial : <T>(x: Partial<T>) => T
156
- >T : T
157
106
>x : Partial<T>
158
- >Partial : Partial<T>
159
- >T : T
160
- >T : T
161
107
162
108
declare let x20: [number | undefined, string?, ...boolean[]];
163
109
>x20 : [number | undefined, (string | undefined)?, ...boolean[]]
@@ -190,39 +136,20 @@ let y22 = nonpartial(x22);
190
136
191
137
type Awaited<T> = T extends PromiseLike<infer U> ? U : T;
192
138
>Awaited : Awaited<T>
193
- >T : T
194
- >T : T
195
- >PromiseLike : PromiseLike<T>
196
- >U : U
197
- >U : U
198
- >T : T
199
139
200
140
type Awaitified<T> = { [P in keyof T]: Awaited<T[P]> };
201
141
>Awaitified : Awaitified<T>
202
- >T : T
203
- >P : P
204
- >T : T
205
- >Awaited : Awaited<T>
206
- >T : T
207
- >P : P
208
142
209
143
declare function all<T extends any[]>(...values: T): Promise<Awaitified<T>>;
210
144
>all : <T extends any[]>(...values: T) => Promise<Awaitified<T>>
211
- >T : T
212
145
>values : T
213
- >T : T
214
- >Promise : Promise<T>
215
- >Awaitified : Awaitified<T>
216
- >T : T
217
146
218
147
function f1(a: number, b: Promise<number>, c: string[], d: Promise<string[]>) {
219
148
>f1 : (a: number, b: Promise<number>, c: string[], d: Promise<string[]>) => void
220
149
>a : number
221
150
>b : Promise<number>
222
- >Promise : Promise<T>
223
151
>c : string[]
224
152
>d : Promise<string[]>
225
- >Promise : Promise<T>
226
153
227
154
let x1 = all(a);
228
155
>x1 : Promise<[number]>
0 commit comments