Skip to content

Commit aa411ac

Browse files
authored
Add a test for constraint of an infer type parameter not being fully instantiated previously (#59760)
1 parent d9eeeae commit aa411ac

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//// [tests/cases/conformance/types/conditional/inferTypesWithExtendsDependingOnTypeVariables.ts] ////
2+
3+
=== inferTypesWithExtendsDependingOnTypeVariables.ts ===
4+
// repro from https://github.com/microsoft/TypeScript/issues/54197
5+
6+
type Bar<K, T extends readonly unknown[]> = T extends readonly [any, ...infer X extends readonly K[]] ? X : never;
7+
>Bar : Symbol(Bar, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 0, 0))
8+
>K : Symbol(K, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 2, 9))
9+
>T : Symbol(T, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 2, 11))
10+
>T : Symbol(T, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 2, 11))
11+
>X : Symbol(X, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 2, 77))
12+
>K : Symbol(K, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 2, 9))
13+
>X : Symbol(X, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 2, 77))
14+
15+
type Res1 = Bar<"a" | "b", ["a", "b", "b"]>
16+
>Res1 : Symbol(Res1, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 2, 114))
17+
>Bar : Symbol(Bar, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 0, 0))
18+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//// [tests/cases/conformance/types/conditional/inferTypesWithExtendsDependingOnTypeVariables.ts] ////
2+
3+
=== inferTypesWithExtendsDependingOnTypeVariables.ts ===
4+
// repro from https://github.com/microsoft/TypeScript/issues/54197
5+
6+
type Bar<K, T extends readonly unknown[]> = T extends readonly [any, ...infer X extends readonly K[]] ? X : never;
7+
>Bar : Bar<K, T>
8+
> : ^^^^^^^^^
9+
10+
type Res1 = Bar<"a" | "b", ["a", "b", "b"]>
11+
>Res1 : ["b", "b"]
12+
> : ^^^^^^^^^^
13+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// @strict: true
2+
// @noEmit: true
3+
4+
// repro from https://github.com/microsoft/TypeScript/issues/54197
5+
6+
type Bar<K, T extends readonly unknown[]> = T extends readonly [any, ...infer X extends readonly K[]] ? X : never;
7+
type Res1 = Bar<"a" | "b", ["a", "b", "b"]>

0 commit comments

Comments
 (0)