Skip to content

[consistent-type-definitions] invalid fixer for declare type #4333

Closed
@armano2

Description

@armano2

Fixer incorrectly changes declare keyword to interface

issue is present for type and interface options and its related to sourceCode.getFirstToken(node);

Repro

Playground

Code

export declare type LocalStorageOption = {
  blurb: string;
  flag: string;
};

Eslint config

{
  "rules": {
    "@typescript-eslint/consistent-type-definitions": "error"
  }
}

Expected Result

export declare interface LocalStorageOption {
  blurb: string;
  flag: string;
};

Actual Result

export interface type LocalStorageOption {
  blurb: string;
  flag: string;
};

Versions

package version
@typescript-eslint/eslint-plugin 5.8.0
@typescript-eslint/parser 5.8.0
TypeScript 4.5.2
ESLint 8.1.0
Env web

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghas prthere is a PR raised to close thispackage: 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