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: consistent-type-definitions leaves trailing parenthesis when converting a paren-wrapped type to an interface #10233

Closed
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: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@rdecoito

Description

@rdecoito

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.

Issue Description

This isn't actually a complex issue, but I didn't immediately see how to set eslint version 9 in the playground and I wasn't interested in learning, since I already had a reproduction repo set up.

The issue is that when you use the --fix argument with the@typescript-eslint/consistent-type-definitions rule, it will leave a trailing parenthesis if the type it converts was wrapped in parens.

For example, the following code

exporttypeInterface=({[key:string]:unknown;});

becomes

exportinterfaceInterface{[key:string]:unknown;});

triggering a syntax error.

I tried this on the latest version of typescript-eslint, including 8.12.2 and 8.12.3-alpha.1

Reproduction Repository Link

https://github.com/rdecoito/repro-consistent-type-definitions

Repro Steps

Copy-pasted from README in repo:

  1. Clone this repo
  2. Runnpm i
  3. Runnpm run lint
    • You'll see an error reported that the type defined in src/index.ts should be an interface instead
  4. Runnpm run lint -- --fix
    • You'll see a new syntax error reported. Open src/index.ts to see the problem: the rule left behind a parenthesis that it shouldn't have

Versions

packageversion
typescript-eslint~8.11.0
TypeScript5.6.3
ESLint~9.13.0
node20.18.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: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    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