-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test for constraint of an infer type parameter not being fully …
…instantiated previously (#59760)
- Loading branch information
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
tests/baselines/reference/inferTypesWithExtendsDependingOnTypeVariables.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//// [tests/cases/conformance/types/conditional/inferTypesWithExtendsDependingOnTypeVariables.ts] //// | ||
|
||
=== inferTypesWithExtendsDependingOnTypeVariables.ts === | ||
// repro from https://github.com/microsoft/TypeScript/issues/54197 | ||
|
||
type Bar<K, T extends readonly unknown[]> = T extends readonly [any, ...infer X extends readonly K[]] ? X : never; | ||
>Bar : Symbol(Bar, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 0, 0)) | ||
>K : Symbol(K, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 2, 9)) | ||
>T : Symbol(T, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 2, 11)) | ||
>T : Symbol(T, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 2, 11)) | ||
>X : Symbol(X, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 2, 77)) | ||
>K : Symbol(K, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 2, 9)) | ||
>X : Symbol(X, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 2, 77)) | ||
|
||
type Res1 = Bar<"a" | "b", ["a", "b", "b"]> | ||
>Res1 : Symbol(Res1, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 2, 114)) | ||
>Bar : Symbol(Bar, Decl(inferTypesWithExtendsDependingOnTypeVariables.ts, 0, 0)) | ||
|
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/inferTypesWithExtendsDependingOnTypeVariables.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//// [tests/cases/conformance/types/conditional/inferTypesWithExtendsDependingOnTypeVariables.ts] //// | ||
|
||
=== inferTypesWithExtendsDependingOnTypeVariables.ts === | ||
// repro from https://github.com/microsoft/TypeScript/issues/54197 | ||
|
||
type Bar<K, T extends readonly unknown[]> = T extends readonly [any, ...infer X extends readonly K[]] ? X : never; | ||
>Bar : Bar<K, T> | ||
> : ^^^^^^^^^ | ||
|
||
type Res1 = Bar<"a" | "b", ["a", "b", "b"]> | ||
>Res1 : ["b", "b"] | ||
> : ^^^^^^^^^^ | ||
|
7 changes: 7 additions & 0 deletions
7
tests/cases/conformance/types/conditional/inferTypesWithExtendsDependingOnTypeVariables.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// @strict: true | ||
// @noEmit: true | ||
|
||
// repro from https://github.com/microsoft/TypeScript/issues/54197 | ||
|
||
type Bar<K, T extends readonly unknown[]> = T extends readonly [any, ...infer X extends readonly K[]] ? X : never; | ||
type Res1 = Bar<"a" | "b", ["a", "b", "b"]> |