Skip to content

Commit cbf4be5

Browse files
committed
Add test case for microsoft#52271
1 parent f526e16 commit cbf4be5

5 files changed

+83
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
tests/cases/compiler/substitutionTypePassedToExtends.ts(4,16): error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
2+
tests/cases/compiler/substitutionTypePassedToExtends.ts(4,31): error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
3+
tests/cases/compiler/substitutionTypePassedToExtends.ts(4,53): error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
4+
tests/cases/compiler/substitutionTypePassedToExtends.ts(5,21): error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
5+
6+
7+
==== tests/cases/compiler/substitutionTypePassedToExtends.ts (4 errors) ====
8+
type Foo1<A,B> = [A, B] extends unknown[][] ? Bar1<[A, B]> : 'else'
9+
type Bar1<T extends unknown[][]> = T
10+
11+
type Foo2<A> = Set<A> extends Set<unknown[]> ? Bar2<Set<A>> : 'else'
12+
~~~
13+
!!! error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
14+
~~~
15+
!!! error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
16+
~~~
17+
!!! error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
18+
type Bar2<T extends Set<unknown[]>> = T
19+
~~~
20+
!!! error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
21+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//// [substitutionTypePassedToExtends.ts]
2+
type Foo1<A,B> = [A, B] extends unknown[][] ? Bar1<[A, B]> : 'else'
3+
type Bar1<T extends unknown[][]> = T
4+
5+
type Foo2<A> = Set<A> extends Set<unknown[]> ? Bar2<Set<A>> : 'else'
6+
type Bar2<T extends Set<unknown[]>> = T
7+
8+
9+
//// [substitutionTypePassedToExtends.js]
10+
"use strict";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
=== tests/cases/compiler/substitutionTypePassedToExtends.ts ===
2+
type Foo1<A,B> = [A, B] extends unknown[][] ? Bar1<[A, B]> : 'else'
3+
>Foo1 : Symbol(Foo1, Decl(substitutionTypePassedToExtends.ts, 0, 0))
4+
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 0, 10))
5+
>B : Symbol(B, Decl(substitutionTypePassedToExtends.ts, 0, 12))
6+
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 0, 10))
7+
>B : Symbol(B, Decl(substitutionTypePassedToExtends.ts, 0, 12))
8+
>Bar1 : Symbol(Bar1, Decl(substitutionTypePassedToExtends.ts, 0, 67))
9+
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 0, 10))
10+
>B : Symbol(B, Decl(substitutionTypePassedToExtends.ts, 0, 12))
11+
12+
type Bar1<T extends unknown[][]> = T
13+
>Bar1 : Symbol(Bar1, Decl(substitutionTypePassedToExtends.ts, 0, 67))
14+
>T : Symbol(T, Decl(substitutionTypePassedToExtends.ts, 1, 10))
15+
>T : Symbol(T, Decl(substitutionTypePassedToExtends.ts, 1, 10))
16+
17+
type Foo2<A> = Set<A> extends Set<unknown[]> ? Bar2<Set<A>> : 'else'
18+
>Foo2 : Symbol(Foo2, Decl(substitutionTypePassedToExtends.ts, 1, 36))
19+
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 3, 10))
20+
>Set : Symbol(Set)
21+
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 3, 10))
22+
>Set : Symbol(Set)
23+
>Bar2 : Symbol(Bar2, Decl(substitutionTypePassedToExtends.ts, 3, 68))
24+
>Set : Symbol(Set)
25+
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 3, 10))
26+
27+
type Bar2<T extends Set<unknown[]>> = T
28+
>Bar2 : Symbol(Bar2, Decl(substitutionTypePassedToExtends.ts, 3, 68))
29+
>T : Symbol(T, Decl(substitutionTypePassedToExtends.ts, 4, 10))
30+
>Set : Symbol(Set)
31+
>T : Symbol(T, Decl(substitutionTypePassedToExtends.ts, 4, 10))
32+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
=== tests/cases/compiler/substitutionTypePassedToExtends.ts ===
2+
type Foo1<A,B> = [A, B] extends unknown[][] ? Bar1<[A, B]> : 'else'
3+
>Foo1 : Foo1<A, B>
4+
5+
type Bar1<T extends unknown[][]> = T
6+
>Bar1 : T
7+
8+
type Foo2<A> = Set<A> extends Set<unknown[]> ? Bar2<Set<A>> : 'else'
9+
>Foo2 : Set<A>
10+
11+
type Bar2<T extends Set<unknown[]>> = T
12+
>Bar2 : T
13+
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// @strict: true
2+
3+
type Foo1<A,B> = [A, B] extends unknown[][] ? Bar1<[A, B]> : 'else'
4+
type Bar1<T extends unknown[][]> = T
5+
6+
type Foo2<A> = Set<A> extends Set<unknown[]> ? Bar2<Set<A>> : 'else'
7+
type Bar2<T extends Set<unknown[]>> = T

0 commit comments

Comments
 (0)