-
-
Notifications
You must be signed in to change notification settings - Fork 227
/
mapped-types.spec.ts.snap
281 lines (160 loc) · 18.8 KB
/
mapped-types.spec.ts.snap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Assign const result: Assign<{}, Omit<T, 'age'>> = rest (type) should match snapshot 1`] = `"any"`;
exports[`Assign testType<Assign<Props, NewProps>>() (type) should match snapshot 1`] = `"Pick<Pick<Props, \\"name\\" | \\"visible\\"> & Pick<NewProps, \\"age\\"> & Pick<NewProps, \\"other\\">, \\"name\\" | \\"age\\" | \\"visible\\" | \\"other\\">"`;
exports[`AugmentedMutable testType<AugmentedMutable<Readonly<Props>, 'name' | 'age'>>({
name: 'Yolo',
age: 99,
visible: true,
}) (type) should match snapshot 1`] = `"AugmentedMutable<Readonly<Props>, \\"name\\" | \\"age\\">"`;
exports[`AugmentedMutable testType<AugmentedMutable<Readonly<Props>>>({
name: 'Yolo',
age: 99,
visible: true,
}) (type) should match snapshot 1`] = `"AugmentedMutable<Readonly<Props>, \\"name\\" | \\"age\\" | \\"visible\\">"`;
exports[`AugmentedMutable testType<AugmentedMutable<Readonly<Props>>['age']>(99) (type) should match snapshot 1`] = `"number"`;
exports[`AugmentedMutable testType<AugmentedMutable<Readonly<Props>>['name']>('Yolo') (type) should match snapshot 1`] = `"string"`;
exports[`AugmentedMutable testType<AugmentedMutable<Readonly<Props>>['visible']>(true) (type) should match snapshot 1`] = `"boolean"`;
exports[`AugmentedReadonly testType<AugmentedReadonly<Props, 'name' | 'age'>>({
name: 'Yolo',
age: 99,
visible: true,
}) (type) should match snapshot 1`] = `"AugmentedReadonly<Props, \\"name\\" | \\"age\\">"`;
exports[`AugmentedReadonly testType<AugmentedReadonly<Props>>({
name: 'Yolo',
age: 99,
visible: true,
}) (type) should match snapshot 1`] = `"AugmentedReadonly<Props, \\"name\\" | \\"age\\" | \\"visible\\">"`;
exports[`AugmentedReadonly testType<AugmentedReadonly<Props>['age']>() (type) should match snapshot 1`] = `"number"`;
exports[`AugmentedReadonly testType<AugmentedReadonly<Props>['name']>() (type) should match snapshot 1`] = `"string"`;
exports[`AugmentedReadonly testType<AugmentedReadonly<Props>['visible']>() (type) should match snapshot 1`] = `"boolean"`;
exports[`AugmentedReadonly testType<ReadonlyKeys<AugmentedReadonly<Props, 'name' | 'age'>>>() (type) should match snapshot 1`] = `"\\"name\\" | \\"age\\""`;
exports[`AugmentedRequired testType<AugmentedRequired<Partial<Props>, 'age' | 'visible'>>({
age: 99,
visible: true,
}) (type) should match snapshot 1`] = `"AugmentedRequired<Partial<Props>, \\"age\\" | \\"visible\\">"`;
exports[`AugmentedRequired testType<AugmentedRequired<Partial<Props>>>({
name: 'Yolo',
age: 99,
visible: true,
}) (type) should match snapshot 1`] = `"AugmentedRequired<Partial<Props>, \\"name\\" | \\"age\\" | \\"visible\\">"`;
exports[`Brand testType<Brand<number, 'USD'>>() (type) should match snapshot 1`] = `"Brand<number, \\"USD\\">"`;
exports[`DeepNonNullable testType<
DeepNonNullable<NestedArrayProps>['first']['second'][number]['name']
>() (type) should match snapshot 1`] = `"string"`;
exports[`DeepNonNullable testType<
ReturnType<DeepNonNullable<NestedFunctionProps>['first']['second']>
>() (type) should match snapshot 1`] = `"string"`;
exports[`DeepNonNullable testType<DeepNonNullable<NestedArrayProps>['first']>() (type) should match snapshot 1`] = `"_DeepNonNullableObject<{ second?: ({ name?: string | null | undefined; } | null | undefined)[] | undefined; }>"`;
exports[`DeepNonNullable testType<DeepNonNullable<NestedArrayProps>['first']['second']>() (type) should match snapshot 1`] = `"_DeepNonNullableArray<{ name?: string | null | undefined; } | null | undefined>"`;
exports[`DeepNonNullable testType<DeepNonNullable<NestedFunctionProps>['first']>() (type) should match snapshot 1`] = `"_DeepNonNullableObject<{ second?: ((value: number) => string) | undefined; }>"`;
exports[`DeepNonNullable testType<DeepNonNullable<NestedFunctionProps>['first']['second']>() (type) should match snapshot 1`] = `"(value: number) => string"`;
exports[`DeepNonNullable testType<DeepNonNullable<NestedProps>['first']>() (type) should match snapshot 1`] = `"_DeepNonNullableObject<{ second?: { name?: string | null | undefined; } | null | undefined; }>"`;
exports[`DeepNonNullable testType<DeepNonNullable<NestedProps>['first']['second']>() (type) should match snapshot 1`] = `"_DeepNonNullableObject<{ name?: string | null | undefined; }>"`;
exports[`DeepNonNullable testType<DeepNonNullable<NestedProps>['first']['second']['name']>() (type) should match snapshot 1`] = `"string"`;
exports[`DeepPartial testType<ReturnType<NonNullable<typeof functionProp>>>() (type) should match snapshot 1`] = `"string"`;
exports[`DeepPartial testType<typeof arrayItem.name>() (type) should match snapshot 1`] = `"string | undefined"`;
exports[`DeepPartial testType<typeof arrayProp>() (type) should match snapshot 1`] = `"_DeepPartialArray<{ name: string; }> | undefined"`;
exports[`DeepPartial testType<typeof functionProp>() (type) should match snapshot 1`] = `"((value: number) => string) | undefined"`;
exports[`DeepPartial testType<typeof name>() (type) should match snapshot 1`] = `"string | undefined"`;
exports[`DeepPartial testType<typeof nestedArrayPartial.first>() (type) should match snapshot 1`] = `"_DeepPartialObject<{ second: { name: string; }[]; }> | undefined"`;
exports[`DeepPartial testType<typeof nestedFunctionPartial.first>() (type) should match snapshot 1`] = `"_DeepPartialObject<{ second: (value: number) => string; }> | undefined"`;
exports[`DeepPartial testType<typeof partialNested.first>() (type) should match snapshot 1`] = `"_DeepPartialObject<{ second: { name: string; }; }> | undefined"`;
exports[`DeepPartial testType<typeof second>() (type) should match snapshot 1`] = `"_DeepPartialObject<{ name: string; }> | undefined"`;
exports[`DeepReadonly testType<DeepReadonly<DeepReadonly<NestedArrayProps>>>() (type) should match snapshot 1`] = `"_DeepReadonlyObject<{ first: { second: { name: string; }[]; }; }>"`;
exports[`DeepReadonly testType<DeepReadonly<DeepReadonly<NestedProps>>>() (type) should match snapshot 1`] = `"_DeepReadonlyObject<{ first: { second: { name: string; }; }; }>"`;
exports[`DeepReadonly testType<DeepReadonly<NestedArrayProps>['first']>() (type) should match snapshot 1`] = `"_DeepReadonlyObject<{ second: { name: string; }[]; }>"`;
exports[`DeepReadonly testType<DeepReadonly<NestedArrayProps>['first']['second']>() (type) should match snapshot 1`] = `"_DeepReadonlyArray<{ name: string; }>"`;
exports[`DeepReadonly testType<DeepReadonly<NestedArrayProps>['first']['second'][number]['name']>() (type) should match snapshot 1`] = `"string"`;
exports[`DeepReadonly testType<DeepReadonly<NestedFunctionProps>['first']>() (type) should match snapshot 1`] = `"_DeepReadonlyObject<{ second: (value: number) => string; }>"`;
exports[`DeepReadonly testType<DeepReadonly<NestedFunctionProps>['first']['second']>() (type) should match snapshot 1`] = `"(value: number) => string"`;
exports[`DeepReadonly testType<DeepReadonly<NestedProps>['first']>() (type) should match snapshot 1`] = `"_DeepReadonlyObject<{ second: { name: string; }; }>"`;
exports[`DeepReadonly testType<DeepReadonly<NestedProps>['first']['second']>() (type) should match snapshot 1`] = `"_DeepReadonlyObject<{ name: string; }>"`;
exports[`DeepReadonly testType<DeepReadonly<NestedProps>['first']['second']['name']>() (type) should match snapshot 1`] = `"string"`;
exports[`DeepReadonly testType<DeepReadonly<string | null | boolean | number | bigint | symbol>>() (type) should match snapshot 1`] = `"string | number | bigint | boolean | symbol | null"`;
exports[`DeepReadonly testType<ReturnType<DeepReadonly<NestedFunctionProps>['first']['second']>>() (type) should match snapshot 1`] = `"string"`;
exports[`DeepRequired testType<DeepRequired<NestedArrayProps>['first']>() (type) should match snapshot 1`] = `"_DeepRequiredObject<{ second?: ({ name?: string | null | undefined; } | undefined)[] | undefined; }>"`;
exports[`DeepRequired testType<DeepRequired<NestedArrayProps>['first']['second']>() (type) should match snapshot 1`] = `"_DeepRequiredArray<{ name?: string | null | undefined; } | undefined>"`;
exports[`DeepRequired testType<DeepRequired<NestedArrayProps>['first']['second'][number]['name']>() (type) should match snapshot 1`] = `"string | null"`;
exports[`DeepRequired testType<DeepRequired<NestedFunctionProps>['first']>() (type) should match snapshot 1`] = `"_DeepRequiredObject<{ second?: ((value: number) => string) | undefined; }>"`;
exports[`DeepRequired testType<DeepRequired<NestedFunctionProps>['first']['second']>() (type) should match snapshot 1`] = `"(value: number) => string"`;
exports[`DeepRequired testType<DeepRequired<NestedProps>['first']>() (type) should match snapshot 1`] = `"_DeepRequiredObject<{ second?: { name?: string | null | undefined; } | undefined; }>"`;
exports[`DeepRequired testType<DeepRequired<NestedProps>['first']['second']>() (type) should match snapshot 1`] = `"_DeepRequiredObject<{ name?: string | null | undefined; }>"`;
exports[`DeepRequired testType<DeepRequired<NestedProps>['first']['second']['name']>() (type) should match snapshot 1`] = `"string | null"`;
exports[`DeepRequired testType<ReturnType<DeepRequired<NestedFunctionProps>['first']['second']>>() (type) should match snapshot 1`] = `"string"`;
exports[`Diff const result: Diff<T, Pick<T, 'age'>> = rest (type) should match snapshot 1`] = `"any"`;
exports[`Diff testType<Diff<Props, NewProps>>() (type) should match snapshot 1`] = `"Pick<Props, \\"name\\" | \\"visible\\">"`;
exports[`FunctionKeys testType<FunctionKeys<MixedProps>>() (type) should match snapshot 1`] = `"\\"setName\\" | \\"someFn\\""`;
exports[`Intersection const result: Intersection<T, Omit<T, 'age'>> = rest (type) should match snapshot 1`] = `"any"`;
exports[`Intersection testType<Intersection<Props | NewProps, DefaultProps>>() (type) should match snapshot 1`] = `"Pick<Props | NewProps, \\"age\\">"`;
exports[`Intersection testType<Intersection<Props, DefaultProps>>() (type) should match snapshot 1`] = `"Pick<Props, \\"age\\">"`;
exports[`MutableKeys testType<MutableKeys<ReadWriteProps>>() (type) should match snapshot 1`] = `"\\"b\\""`;
exports[`NonFunctionKeys testType<NonFunctionKeys<MixedProps>>() (type) should match snapshot 1`] = `"\\"name\\" | \\"someKeys\\""`;
exports[`NonUndefined testType<NonUndefined<string | null | undefined>>() (type) should match snapshot 1`] = `"string | null"`;
exports[`NonUndefined testType<NonUndefined<undefined>>() (type) should match snapshot 1`] = `"never"`;
exports[`Omit const result: Omit<T, 'age'> = rest (type) should match snapshot 1`] = `"any"`;
exports[`Omit testType<Omit<Props | NewProps, 'age'>>() (type) should match snapshot 1`] = `"Pick<Props | NewProps, never>"`;
exports[`Omit testType<Omit<Props, 'age'>>() (type) should match snapshot 1`] = `"Pick<Props, \\"name\\" | \\"visible\\">"`;
exports[`Omit testType<Omit<T, 'age'>>() (type) should match snapshot 1`] = `"Pick<T, SetDifference<keyof T, \\"age\\">>"`;
exports[`OmitByValue testType<OmitByValue<RequiredOptionalProps, number | undefined>>() (type) should match snapshot 1`] = `"Pick<RequiredOptionalProps, \\"opt\\" | \\"optUndef\\">"`;
exports[`OmitByValue testType<OmitByValue<RequiredOptionalProps, number>>() (type) should match snapshot 1`] = `"Pick<RequiredOptionalProps, \\"reqUndef\\" | \\"opt\\" | \\"optUndef\\">"`;
exports[`OmitByValue testType<OmitByValue<RequiredOptionalProps, undefined>>() (type) should match snapshot 1`] = `"Pick<RequiredOptionalProps, \\"req\\" | \\"reqUndef\\" | \\"opt\\" | \\"optUndef\\">"`;
exports[`OmitByValue testType<OmitByValue<T, string | boolean>>() (type) should match snapshot 1`] = `"Pick<T, { [Key in keyof T]-?: T[Key] extends string | boolean ? never : Key; }[keyof T]>"`;
exports[`OmitByValue testType<keyof OmitByValue<RequiredOptionalProps, number>>() (type) should match snapshot 1`] = `"\\"reqUndef\\" | \\"opt\\" | \\"optUndef\\""`;
exports[`OmitByValueExact testType<OmitByValueExact<RequiredOptionalProps, number | undefined>>() (type) should match snapshot 1`] = `"Pick<RequiredOptionalProps, \\"req\\" | \\"opt\\" | \\"optUndef\\">"`;
exports[`OmitByValueExact testType<OmitByValueExact<RequiredOptionalProps, number>>() (type) should match snapshot 1`] = `"Pick<RequiredOptionalProps, \\"reqUndef\\" | \\"opt\\" | \\"optUndef\\">"`;
exports[`OmitByValueExact testType<OmitByValueExact<RequiredOptionalProps, undefined>>() (type) should match snapshot 1`] = `"Pick<RequiredOptionalProps, \\"req\\" | \\"reqUndef\\" | \\"opt\\" | \\"optUndef\\">"`;
exports[`OmitByValueExact testType<OmitByValueExact<T, number>>() (type) should match snapshot 1`] = `"Pick<T, { [Key in keyof T]-?: [number] extends [T[Key]] ? [T[Key]] extends [T[Key] & number] ? never : Key : Key; }[keyof T]>"`;
exports[`OmitByValueExact testType<keyof OmitByValueExact<RequiredOptionalProps, number>>() (type) should match snapshot 1`] = `"\\"reqUndef\\" | \\"opt\\" | \\"optUndef\\""`;
exports[`Optional testType<AugmentedPartial<Props, 'age' | 'visible'>>({
name: 'Yolo',
age: 99,
}) (type) should match snapshot 1`] = `"AugmentedPartial<Props, \\"age\\" | \\"visible\\">"`;
exports[`Optional testType<AugmentedPartial<Props, 'age' | 'visible'>>({ name: 'Yolo' }) (type) should match snapshot 1`] = `"AugmentedPartial<Props, \\"age\\" | \\"visible\\">"`;
exports[`Optional testType<AugmentedPartial<Props>>({ age: 99 }) (type) should match snapshot 1`] = `"AugmentedPartial<Props, \\"name\\" | \\"age\\" | \\"visible\\">"`;
exports[`Optional testType<AugmentedPartial<Props>>({}) (type) should match snapshot 1`] = `"AugmentedPartial<Props, \\"name\\" | \\"age\\" | \\"visible\\">"`;
exports[`OptionalKeys testType<OptionalKeys<RequiredOptionalProps>>() (type) should match snapshot 1`] = `"\\"opt\\" | \\"optUndef\\""`;
exports[`Overwrite const result: Overwrite<Omit<T, 'age'>, T> = rest (type) should match snapshot 1`] = `"any"`;
exports[`Overwrite testType<Overwrite<Props, NewProps>>() (type) should match snapshot 1`] = `"Pick<Pick<Props, \\"name\\" | \\"visible\\"> & Pick<NewProps, \\"age\\">, \\"name\\" | \\"age\\" | \\"visible\\">"`;
exports[`PickByValue testType<PickByValue<RequiredOptionalProps, number | undefined>>() (type) should match snapshot 1`] = `"Pick<RequiredOptionalProps, \\"req\\" | \\"reqUndef\\">"`;
exports[`PickByValue testType<PickByValue<RequiredOptionalProps, number>>() (type) should match snapshot 1`] = `"Pick<RequiredOptionalProps, \\"req\\">"`;
exports[`PickByValue testType<PickByValue<RequiredOptionalProps, undefined>>() (type) should match snapshot 1`] = `"Pick<RequiredOptionalProps, never>"`;
exports[`PickByValue testType<PickByValue<T, number>>() (type) should match snapshot 1`] = `"Pick<T, { [Key in keyof T]-?: T[Key] extends number ? Key : never; }[keyof T]>"`;
exports[`PickByValue testType<keyof PickByValue<RequiredOptionalProps, number>>() (type) should match snapshot 1`] = `"\\"req\\""`;
exports[`PickByValueExact testType<PickByValueExact<RequiredOptionalProps, number | undefined>>() (type) should match snapshot 1`] = `"Pick<RequiredOptionalProps, \\"reqUndef\\">"`;
exports[`PickByValueExact testType<PickByValueExact<RequiredOptionalProps, number>>() (type) should match snapshot 1`] = `"Pick<RequiredOptionalProps, \\"req\\">"`;
exports[`PickByValueExact testType<PickByValueExact<RequiredOptionalProps, undefined>>() (type) should match snapshot 1`] = `"Pick<RequiredOptionalProps, never>"`;
exports[`PickByValueExact testType<PickByValueExact<T, number>>() (type) should match snapshot 1`] = `"Pick<T, { [Key in keyof T]-?: [number] extends [T[Key]] ? [T[Key]] extends [T[Key] & number] ? Key : never : never; }[keyof T]>"`;
exports[`PickByValueExact testType<keyof PickByValueExact<RequiredOptionalProps, number>>() (type) should match snapshot 1`] = `"\\"req\\""`;
exports[`PromiseType testType<PromiseType<Promise<string>>>() (type) should match snapshot 1`] = `"string"`;
exports[`ReadonlyKeys testType<ReadonlyKeys<ReadWriteProps>>() (type) should match snapshot 1`] = `"\\"a\\""`;
exports[`RequiredKeys testType<RequiredKeys<RequiredOptionalProps>>() (type) should match snapshot 1`] = `"\\"req\\" | \\"reqUndef\\""`;
exports[`SetComplement testType<SetComplement<'1' | '2' | '3', '2' | '3'>>() (type) should match snapshot 1`] = `"\\"1\\""`;
exports[`SetDifference testType<SetDifference<'1' | '2' | '3', '2' | '3' | '4'>>() (type) should match snapshot 1`] = `"\\"1\\""`;
exports[`SetDifference testType<SetDifference<string | number | (() => void), () => void>>() (type) should match snapshot 1`] = `"string | number"`;
exports[`SetIntersection testType<SetIntersection<'1' | '2' | '3', '2' | '3' | '4'>>() (type) should match snapshot 1`] = `"\\"2\\" | \\"3\\""`;
exports[`SetIntersection testType<SetIntersection<string | number | (() => void), () => void>>() (type) should match snapshot 1`] = `"() => void"`;
exports[`Subtract const result: Subtract<T, Pick<T, 'age'>> = rest (type) should match snapshot 1`] = `"any"`;
exports[`Subtract testType<Subtract<Props, DefaultProps>>() (type) should match snapshot 1`] = `"Pick<Props, \\"name\\" | \\"visible\\">"`;
exports[`SymmetricDifference testType<SymmetricDifference<'1' | '2' | '3', '2' | '3' | '4'>>() (type) should match snapshot 1`] = `"\\"1\\" | \\"4\\""`;
exports[`UnionToIntersection testType<
UnionToIntersection<
{ name: string } | { age: number } | { visible: boolean }
>
>({
name: 'Yolo',
age: 99,
visible: true,
}) (type) should match snapshot 1`] = `"{ name: string; } & { age: number; } & { visible: boolean; }"`;
exports[`UnionToIntersection testType<UnionToIntersection<'name' | 'age'>>() (type) should match snapshot 1`] = `"never"`;
exports[`UnionToIntersection testType<UnionToIntersection<boolean>>() (type) should match snapshot 1`] = `"never"`;
exports[`UnionToIntersection testType<UnionToIntersection<true | false>>() (type) should match snapshot 1`] = `"never"`;
exports[`Unionize testType<Unionize<Props>>() (type) should match snapshot 1`] = `"{ name: string; } | { age: number; } | { visible: boolean; }"`;
exports[`ValuesType testType<ValuesType<[1, 2]>>() (type) should match snapshot 1`] = `"1 | 2"`;
exports[`ValuesType testType<ValuesType<Props>>() (type) should match snapshot 1`] = `"string | number | boolean"`;
exports[`ValuesType testType<ValuesType<ReadonlyArray<string>>>() (type) should match snapshot 1`] = `"string"`;
exports[`ValuesType testType<ValuesType<Uint8Array>>() (type) should match snapshot 1`] = `"number"`;
exports[`ValuesType testType<ValuesType<Uint16Array>>() (type) should match snapshot 1`] = `"number"`;
exports[`ValuesType testType<ValuesType<Uint32Array>>() (type) should match snapshot 1`] = `"number"`;
exports[`ValuesType testType<ValuesType<number[]>>() (type) should match snapshot 1`] = `"number"`;
exports[`ValuesType testType<ValuesType<readonly [1, 2]>>() (type) should match snapshot 1`] = `"1 | 2"`;
exports[`ValuesType testType<ValuesType<readonly symbol[]>>() (type) should match snapshot 1`] = `"symbol"`;