diff --git a/tests/cases/conformance/types/mapped/mappedTypesArraysTuples.ts b/tests/cases/conformance/types/mapped/mappedTypesArraysTuples.ts index 0607462fe0..c936a86c89 100644 --- a/tests/cases/conformance/types/mapped/mappedTypesArraysTuples.ts +++ b/tests/cases/conformance/types/mapped/mappedTypesArraysTuples.ts @@ -63,3 +63,25 @@ function f1(a: number, b: Promise, c: string[], d: Promise) { let x3 = all(a, b, c); let x4 = all(a, b, c, d); } + +function f2(a: Boxified) { + let x: Box | undefined = a.pop(); + let y: Box[] = a.concat(a); +} + +// Repro from #26163 + +type ElementType = T extends Array ? U : never; +type Mapped = { [K in keyof T]: T[K] }; + +type F = ElementType>; +type R1 = F<[string, number, boolean]>; // string | number | boolean +type R2 = ElementType>; // string | number | boolean + +// Repro from #26163 + +declare function acceptArray(arr: any[]): void; +declare function mapArray(arr: T): Mapped; +function acceptMappedArray(arr: T) { + acceptArray(mapArray(arr)); +}