Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bug:key of constructor inclass C { "constructor"() {} } should not be anIdentifier #11084

Open
Labels
ASTPRs and Issues about the AST structureaccepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estree
@overlookmotel

Description

@overlookmotel

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 havesearched for related issues and found none that matched my issue.
  • I haveread the FAQ and my problem is not listed.

Relevant Package

parser

Playground Link

https://typescript-eslint.io/play/#ts=5.8.2&showAST=es&fileType=.tsx&code=MYGwhgzhAEDC0G8BQ1oCJgHsB2EAuATgK7B6YFoAUAlItAL5KNA&eslintrc=N4KABGBEBOCuA2BTAzpAXGYBfEWg&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

classC{"constructor"(){}}

ESLint Config

n/a

tsconfig

n/a

Expected Result

I expectedkey property ofMethodDefinition to be aLiteral, not anIdentifier.

This would match Espree (AST explorer).

Actual Result

key property ofMethodDefinition is anIdentifier:

{"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, wherekey is aLiteral.

But additionally, I feel this is error-prone, because you can normally assume that the section of source text corresponding to anIdentifier's range starts with either aUnicodeIDStart character, or\. This breaks that rule - the first character is".

Additional Info

No response

Versions

packageversion
@typescript-eslint/parser8.30.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    ASTPRs and Issues about the AST structureaccepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estree

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp