-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include index signatures of the source in mapped type template target…
… inferences (#29253)
- Loading branch information
Showing
6 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
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
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
8 changes: 8 additions & 0 deletions
8
tests/baselines/reference/mappedToToIndexSignatureInference.js
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,8 @@ | ||
//// [mappedToToIndexSignatureInference.ts] | ||
declare const fn: <K extends string, V>(object: { [Key in K]: V }) => object; | ||
declare const a: { [index: string]: number }; | ||
fn(a); | ||
|
||
|
||
//// [mappedToToIndexSignatureInference.js] | ||
fn(a); |
18 changes: 18 additions & 0 deletions
18
tests/baselines/reference/mappedToToIndexSignatureInference.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/compiler/mappedToToIndexSignatureInference.ts === | ||
declare const fn: <K extends string, V>(object: { [Key in K]: V }) => object; | ||
>fn : Symbol(fn, Decl(mappedToToIndexSignatureInference.ts, 0, 13)) | ||
>K : Symbol(K, Decl(mappedToToIndexSignatureInference.ts, 0, 19)) | ||
>V : Symbol(V, Decl(mappedToToIndexSignatureInference.ts, 0, 36)) | ||
>object : Symbol(object, Decl(mappedToToIndexSignatureInference.ts, 0, 40)) | ||
>Key : Symbol(Key, Decl(mappedToToIndexSignatureInference.ts, 0, 51)) | ||
>K : Symbol(K, Decl(mappedToToIndexSignatureInference.ts, 0, 19)) | ||
>V : Symbol(V, Decl(mappedToToIndexSignatureInference.ts, 0, 36)) | ||
|
||
declare const a: { [index: string]: number }; | ||
>a : Symbol(a, Decl(mappedToToIndexSignatureInference.ts, 1, 13)) | ||
>index : Symbol(index, Decl(mappedToToIndexSignatureInference.ts, 1, 20)) | ||
|
||
fn(a); | ||
>fn : Symbol(fn, Decl(mappedToToIndexSignatureInference.ts, 0, 13)) | ||
>a : Symbol(a, Decl(mappedToToIndexSignatureInference.ts, 1, 13)) | ||
|
14 changes: 14 additions & 0 deletions
14
tests/baselines/reference/mappedToToIndexSignatureInference.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,14 @@ | ||
=== tests/cases/compiler/mappedToToIndexSignatureInference.ts === | ||
declare const fn: <K extends string, V>(object: { [Key in K]: V }) => object; | ||
>fn : <K extends string, V>(object: { [Key in K]: V; }) => object | ||
>object : { [Key in K]: V; } | ||
|
||
declare const a: { [index: string]: number }; | ||
>a : { [index: string]: number; } | ||
>index : string | ||
|
||
fn(a); | ||
>fn(a) : object | ||
>fn : <K extends string, V>(object: { [Key in K]: V; }) => object | ||
>a : { [index: string]: number; } | ||
|
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,3 @@ | ||
declare const fn: <K extends string, V>(object: { [Key in K]: V }) => object; | ||
declare const a: { [index: string]: number }; | ||
fn(a); |