Skip to content

Commit c2a53f9

Browse files
committed
Add regression tests
1 parent d6b6bb7 commit c2a53f9

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Diff for: tests/cases/compiler/tupleTypeInference2.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// @strict: true
2+
3+
// Repro from #22564
4+
5+
type A<R> = [R] | [R, string];
6+
declare function f<T>(x: A<T>): T;
7+
f([undefined, ''] as [never, string]); // T: never
8+
f([undefined, ''] as [void, string]); // T: void
9+
10+
// Repro from #22563
11+
12+
type B<R, S> = [R] | [R, S];
13+
declare function g<T, U>(f: B<T, U>): U;
14+
g([[]] as [void[]]); // U: {}
15+
16+
type C<R, S> = [R[]] | [R[], S];
17+
declare function h<T, U>(f: C<T, U>): U;
18+
h([[]] as [void[]]); // U: {}
19+
20+
// Repro from #22562
21+
22+
type C2<R> = [R[]] | [R[], void];
23+
declare function h2<T>(f: C2<T>): T;
24+
h2([[]] as [never[]]); // T: never
25+
h2([[]] as [void[]]); // T: void

0 commit comments

Comments
 (0)