We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d6b6bb7 commit c2a53f9Copy full SHA for c2a53f9
tests/cases/compiler/tupleTypeInference2.ts
@@ -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