Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug: The token type of a private name should be PrivateIdentifier instead of Identifier and the value should be the string value of a private name #11022

Closed
@JLHwung

Description

@JLHwung

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

ast-spec

Playground Link

https://typescript-eslint.io/play/#ts=5.6.2&showAST=es&fileType=.tsx&code=MYGwhgzhAEDC0G9oGIAOBuaBfIA&eslintrc=N4KABGBEBOCuA2BTAzpAXGYBfEWg&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=true

Repro Code

class C { #p; }

ESLint Config

module.exports = {
  parser: "@typescript-eslint/parser",
  rules: {
    "@typescript-eslint/<rule-name>": ["error", ...<options>],
  },
};

tsconfig

{
  "compilerOptions": {
    // ...
  }
}

Expected Result

.ast.tokens[3].type should be PrivateIdentifier and .ast.tokens[3].value should be "p".

Actual Result

.ast.tokens[3].type is Identifier and .ast.tokens[3].value is #p.

Additional Info

No response

Versions

package version
@typescript-eslint/typescript-estree 8.28.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: 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