Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test case for #52271 #52333

Merged
merged 2 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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.
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.
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.
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.


==== tests/cases/compiler/substitutionTypePassedToExtends.ts (4 errors) ====
type Foo1<A,B> = [A, B] extends unknown[][] ? Bar1<[A, B]> : 'else'
type Bar1<T extends unknown[][]> = T

type Foo2<A> = Set<A> extends Set<unknown[]> ? Bar2<Set<A>> : 'else'
~~~
!!! error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
~~~
!!! error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
~~~
!!! error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
type Bar2<T extends Set<unknown[]>> = T
~~~
!!! error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.

10 changes: 10 additions & 0 deletions tests/baselines/reference/substitutionTypePassedToExtends.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//// [substitutionTypePassedToExtends.ts]
type Foo1<A,B> = [A, B] extends unknown[][] ? Bar1<[A, B]> : 'else'
type Bar1<T extends unknown[][]> = T

type Foo2<A> = Set<A> extends Set<unknown[]> ? Bar2<Set<A>> : 'else'
type Bar2<T extends Set<unknown[]>> = T


//// [substitutionTypePassedToExtends.js]
"use strict";
32 changes: 32 additions & 0 deletions tests/baselines/reference/substitutionTypePassedToExtends.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
=== tests/cases/compiler/substitutionTypePassedToExtends.ts ===
type Foo1<A,B> = [A, B] extends unknown[][] ? Bar1<[A, B]> : 'else'
>Foo1 : Symbol(Foo1, Decl(substitutionTypePassedToExtends.ts, 0, 0))
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 0, 10))
>B : Symbol(B, Decl(substitutionTypePassedToExtends.ts, 0, 12))
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 0, 10))
>B : Symbol(B, Decl(substitutionTypePassedToExtends.ts, 0, 12))
>Bar1 : Symbol(Bar1, Decl(substitutionTypePassedToExtends.ts, 0, 67))
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 0, 10))
>B : Symbol(B, Decl(substitutionTypePassedToExtends.ts, 0, 12))

type Bar1<T extends unknown[][]> = T
>Bar1 : Symbol(Bar1, Decl(substitutionTypePassedToExtends.ts, 0, 67))
>T : Symbol(T, Decl(substitutionTypePassedToExtends.ts, 1, 10))
>T : Symbol(T, Decl(substitutionTypePassedToExtends.ts, 1, 10))

type Foo2<A> = Set<A> extends Set<unknown[]> ? Bar2<Set<A>> : 'else'
>Foo2 : Symbol(Foo2, Decl(substitutionTypePassedToExtends.ts, 1, 36))
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 3, 10))
>Set : Symbol(Set)
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 3, 10))
>Set : Symbol(Set)
>Bar2 : Symbol(Bar2, Decl(substitutionTypePassedToExtends.ts, 3, 68))
>Set : Symbol(Set)
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 3, 10))

type Bar2<T extends Set<unknown[]>> = T
>Bar2 : Symbol(Bar2, Decl(substitutionTypePassedToExtends.ts, 3, 68))
>T : Symbol(T, Decl(substitutionTypePassedToExtends.ts, 4, 10))
>Set : Symbol(Set)
>T : Symbol(T, Decl(substitutionTypePassedToExtends.ts, 4, 10))

13 changes: 13 additions & 0 deletions tests/baselines/reference/substitutionTypePassedToExtends.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
=== tests/cases/compiler/substitutionTypePassedToExtends.ts ===
type Foo1<A,B> = [A, B] extends unknown[][] ? Bar1<[A, B]> : 'else'
>Foo1 : Foo1<A, B>

type Bar1<T extends unknown[][]> = T
>Bar1 : T

type Foo2<A> = Set<A> extends Set<unknown[]> ? Bar2<Set<A>> : 'else'
>Foo2 : Set<A>

type Bar2<T extends Set<unknown[]>> = T
>Bar2 : T

7 changes: 7 additions & 0 deletions tests/cases/compiler/substitutionTypePassedToExtends.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// @strict: true
jakebailey marked this conversation as resolved.
Show resolved Hide resolved

type Foo1<A,B> = [A, B] extends unknown[][] ? Bar1<[A, B]> : 'else'
type Bar1<T extends unknown[][]> = T

type Foo2<A> = Set<A> extends Set<unknown[]> ? Bar2<Set<A>> : 'else'
type Bar2<T extends Set<unknown[]>> = T