mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-04-17 01:49:41 -05:00
Fixes https://github.com/microsoft/TypeScript/issues/52271
This commit is contained in:
10
tests/baselines/reference/substitutionTypePassedToExtends.js
Normal file
10
tests/baselines/reference/substitutionTypePassedToExtends.js
Normal file
@@ -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";
|
||||
@@ -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, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
|
||||
>A : Symbol(A, Decl(substitutionTypePassedToExtends.ts, 3, 10))
|
||||
>Set : Symbol(Set, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
|
||||
>Bar2 : Symbol(Bar2, Decl(substitutionTypePassedToExtends.ts, 3, 68))
|
||||
>Set : Symbol(Set, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
|
||||
>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, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(substitutionTypePassedToExtends.ts, 4, 10))
|
||||
|
||||
@@ -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 : Foo2<A>
|
||||
|
||||
type Bar2<T extends Set<unknown[]>> = T
|
||||
>Bar2 : T
|
||||
|
||||
8
tests/cases/compiler/substitutionTypePassedToExtends.ts
Normal file
8
tests/cases/compiler/substitutionTypePassedToExtends.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
// @strict: true
|
||||
// @target: esnext
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user