Skip to content

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

@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

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy