🌐 AI搜索 & 代理 主页
Skip to content

Bug: Incorrect "TSImportType#options" end when the option key-value contains trailing comma #11474

@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

parser

Playground Link

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

Repro Code

let x: typeof import("foo.json", { with: { type: "json" }, });

ESLint Config

{
  "rules": {}
}

tsconfig

{
  "compilerOptions": {
    "strictNullChecks": true
  }
}

Expected Result

The "TSImportType#options", an ObjectExpression, should end at column 60, the last } in the source.

Actual Result

The ObjectExpression currently ends at column 58, the trailing , in the source.

Additional Info

The trailing comma within option has been supported since TS 5.9.

Versions

package version
@typescript-eslint/parser 8.39.1
TypeScript 5.9.2

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