Open
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Relevant Package
parser
Playground Link
Repro Code
class C {
"constructor"() { }
}
ESLint Config
n/a
tsconfig
Expected Result
I expected key
property of MethodDefinition
to be a Literal
, not an Identifier
.
This would match Espree (AST explorer).
Actual Result
key
property of MethodDefinition
is an Identifier
:
{
"type": "MethodDefinition",
"key": {
"type": "Identifier",
"range": [12, 25],
"name": "constructor",
"decorators": [],
"optional": false,
"typeAnnotation": null
},
"kind": "constructor",
"...": "..."
}
Main reason I think this is a bug is that it's different from Espree, where key
is a Literal
.
But additionally, I feel this is error-prone, because you can normally assume that the section of source text corresponding to an Identifier
's range starts with either a UnicodeIDStart character, or \
. This breaks that rule - the first character is "
.
Additional Info
No response
Versions
package | version |
---|---|
@typescript-eslint/parser |
8.30.1 |
Metadata
Metadata
Assignees
Labels
PRs and Issues about the AST structurePRs and Issues about the AST structureGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issueSomething isn't workingSomething isn't workingIssues related to @typescript-eslint/typescript-estreeIssues related to @typescript-eslint/typescript-estree