forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly check computed property names in type-space get/set accesso…
…rs (microsoft#47156) * Add test that should fail * Make it fail Fixes microsoft#47146 * Baselines
- Loading branch information
1 parent
46e7ab4
commit 2172e19
Showing
6 changed files
with
49 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
tests/cases/compiler/noMappedGetSet.ts(2,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. | ||
tests/cases/compiler/noMappedGetSet.ts(2,10): error TS2304: Cannot find name 'K'. | ||
tests/cases/compiler/noMappedGetSet.ts(2,15): error TS2304: Cannot find name 'WAT'. | ||
|
||
|
||
==== tests/cases/compiler/noMappedGetSet.ts (3 errors) ==== | ||
type OH_NO = { | ||
get [K in WAT](): string | ||
~~~~~~~~~~ | ||
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. | ||
~ | ||
!!! error TS2304: Cannot find name 'K'. | ||
~~~ | ||
!!! error TS2304: Cannot find name 'WAT'. | ||
}; | ||
|
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 @@ | ||
//// [noMappedGetSet.ts] | ||
type OH_NO = { | ||
get [K in WAT](): string | ||
}; | ||
|
||
|
||
//// [noMappedGetSet.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,9 @@ | ||
=== tests/cases/compiler/noMappedGetSet.ts === | ||
type OH_NO = { | ||
>OH_NO : Symbol(OH_NO, Decl(noMappedGetSet.ts, 0, 0)) | ||
|
||
get [K in WAT](): string | ||
>[K in WAT] : Symbol([K in WAT], Decl(noMappedGetSet.ts, 0, 14)) | ||
|
||
}; | ||
|
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,12 @@ | ||
=== tests/cases/compiler/noMappedGetSet.ts === | ||
type OH_NO = { | ||
>OH_NO : OH_NO | ||
|
||
get [K in WAT](): string | ||
>[K in WAT] : string | ||
>K in WAT : boolean | ||
>K : any | ||
>WAT : any | ||
|
||
}; | ||
|
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 @@ | ||
type OH_NO = { | ||
get [K in WAT](): string | ||
}; |