Skip to content

Incorrect string property suggestion for private field returned outside of class #36082

@mjbvz

Description

@mjbvz

TypeScript Version: 3.8.0-dev.20200108

Search Terms:

  • private fields
  • javascript
  • string property accessor
  • bracket accessor
  • suggestions

Code
For the JavaScript:

//@ts-check

class Prv {
    #value = 1;
}

new Prv()[''];

Trigger suggestions inside the string

Expected behavior:
No suggestions returned

Actual behavior:
A suggestion for #value is returned. This changes the code to:

//@ts-check

class Prv {
    #value = 1;
}

new Prv()['#value'];

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions