Skip to content

Commit cc8a514

Browse files
committed
Mark computed properties with template literals as write access
1 parent 2b93227 commit cc8a514

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/compiler/utilities.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2529,6 +2529,7 @@ namespace ts {
25292529
const parent = name.parent;
25302530
switch (name.kind) {
25312531
case SyntaxKind.StringLiteral:
2532+
case SyntaxKind.NoSubstitutionTemplateLiteral:
25322533
case SyntaxKind.NumericLiteral:
25332534
if (isComputedPropertyName(parent)) return parent.parent;
25342535
// falls through
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
////interface Obj {
4+
//// [|[`[|{| "isDefinition": true, "contextRangeIndex": 0 |}num|]`]: number;|]
5+
////}
6+
////
7+
////let o: Obj = {
8+
//// [|[`[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}num|]`]: 0|]
9+
////};
10+
////
11+
////o = {
12+
//// [|['[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 4 |}num|]']: 1|]
13+
////};
14+
////
15+
////o['[|num|]'] = 2;
16+
////o[`[|num|]`] = 3;
17+
////
18+
////o['[|num|]'];
19+
////o[`[|num|]`];
20+
21+
verify.singleReferenceGroup("(property) Obj[`num`]: number", "num");

0 commit comments

Comments
 (0)