|
| 1 | +// @strict: true |
| 2 | +// @declaration: true |
| 3 | + |
| 4 | +type Box<T> = { value: T }; |
| 5 | +type Boxified<T> = { [P in keyof T]: Box<T[P]> }; |
| 6 | + |
| 7 | +type T00 = Boxified<[number, string?, ...boolean[]]>; |
| 8 | +type T01 = Partial<[number, string?, ...boolean[]]>; |
| 9 | +type T02 = Required<[number, string?, ...boolean[]]>; |
| 10 | + |
| 11 | +type T10 = Boxified<string[]>; |
| 12 | +type T11 = Partial<string[]>; |
| 13 | +type T12 = Required<string[]>; |
| 14 | +type T13 = Boxified<ReadonlyArray<string>>; |
| 15 | +type T14 = Partial<ReadonlyArray<string>>; |
| 16 | +type T15 = Required<ReadonlyArray<string>>; |
| 17 | + |
| 18 | +type T20 = Boxified<(string | undefined)[]>; |
| 19 | +type T21 = Partial<(string | undefined)[]>; |
| 20 | +type T22 = Required<(string | undefined)[]>; |
| 21 | +type T23 = Boxified<ReadonlyArray<string | undefined>>; |
| 22 | +type T24 = Partial<ReadonlyArray<string | undefined>>; |
| 23 | +type T25 = Required<ReadonlyArray<string | undefined>>; |
| 24 | + |
| 25 | +type T30 = Boxified<Partial<string[]>>; |
| 26 | +type T31 = Partial<Boxified<string[]>>; |
| 27 | + |
| 28 | +type A = { a: string }; |
| 29 | +type B = { b: string }; |
| 30 | + |
| 31 | +type T40 = Boxified<A | A[] | ReadonlyArray<A> | [A, B] | string | string[]>; |
| 32 | + |
| 33 | +declare function unboxify<T>(x: Boxified<T>): T; |
| 34 | + |
| 35 | +declare let x10: [Box<number>, Box<string>, ...Box<boolean>[]]; |
| 36 | +let y10 = unboxify(x10); |
| 37 | + |
| 38 | +declare let x11: Box<number>[]; |
| 39 | +let y11 = unboxify(x11); |
| 40 | + |
| 41 | +declare let x12: { a: Box<number>, b: Box<string[]> }; |
| 42 | +let y12 = unboxify(x12); |
| 43 | + |
| 44 | +declare function nonpartial<T>(x: Partial<T>): T; |
| 45 | + |
| 46 | +declare let x20: [number | undefined, string?, ...boolean[]]; |
| 47 | +let y20 = nonpartial(x20); |
| 48 | + |
| 49 | +declare let x21: (number | undefined)[]; |
| 50 | +let y21 = nonpartial(x21); |
| 51 | + |
| 52 | +declare let x22: { a: number | undefined, b?: string[] }; |
| 53 | +let y22 = nonpartial(x22); |
| 54 | + |
| 55 | +type Awaited<T> = T extends PromiseLike<infer U> ? U : T; |
| 56 | +type Awaitified<T> = { [P in keyof T]: Awaited<T[P]> }; |
| 57 | + |
| 58 | +declare function all<T extends any[]>(...values: T): Promise<Awaitified<T>>; |
| 59 | + |
| 60 | +function f1(a: number, b: Promise<number>, c: string[], d: Promise<string[]>) { |
| 61 | + let x1 = all(a); |
| 62 | + let x2 = all(a, b); |
| 63 | + let x3 = all(a, b, c); |
| 64 | + let x4 = all(a, b, c, d); |
| 65 | +} |
0 commit comments