Skip to content

Commit 596493c

Browse files
committed
Add tests
1 parent 9b6f06d commit 596493c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/cases/conformance/types/mapped/mappedTypesArraysTuples.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,25 @@ function f1(a: number, b: Promise<number>, c: string[], d: Promise<string[]>) {
6363
let x3 = all(a, b, c);
6464
let x4 = all(a, b, c, d);
6565
}
66+
67+
function f2<T extends any[]>(a: Boxified<T>) {
68+
let x: Box<any> | undefined = a.pop();
69+
let y: Box<any>[] = a.concat(a);
70+
}
71+
72+
// Repro from #26163
73+
74+
type ElementType<T> = T extends Array<infer U> ? U : never;
75+
type Mapped<T> = { [K in keyof T]: T[K] };
76+
77+
type F<T> = ElementType<Mapped<T>>;
78+
type R1 = F<[string, number, boolean]>; // string | number | boolean
79+
type R2 = ElementType<Mapped<[string, number, boolean]>>; // string | number | boolean
80+
81+
// Repro from #26163
82+
83+
declare function acceptArray(arr: any[]): void;
84+
declare function mapArray<T extends any[]>(arr: T): Mapped<T>;
85+
function acceptMappedArray<T extends any[]>(arr: T) {
86+
acceptArray(mapArray(arr));
87+
}

0 commit comments

Comments
 (0)