Skip to content

[no-empty-interface] Disable in declaration merging contexts #1875

@kripod

Description

@kripod

Repro

{
  "rules": {
    "@typescript-eslint/no-empty-interface": "error"
  }
}
import { tokens } from './theme.treat';

declare module 'treat/theme' {
  type Tokens = typeof tokens;
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
  export interface Theme extends Tokens {}
}

The code above can be found here, along with the referenced theme.treat.ts file in the same directory.

Expected Result

No errors should be thrown, as the Theme interface of module 'treat/theme' is being augmented.

Actual Result

An interface declaring no members is equivalent to its supertype.

(As thrown by @typescript-eslint/no-empty-interface.)

Additional Info

The code above gets auto-fixed to:

import { tokens } from './theme.treat';

declare module 'treat/theme' {
  type Tokens = typeof tokens;
  export type Theme = Tokens;
}

Which throws a TypeScript error ts(2300):

Duplicate identifier 'Theme'.

Versions

package version
@typescript-eslint/eslint-plugin 2.27.0
@typescript-eslint/parser 2.27.0
TypeScript 3.8.3
ESLint 6.8.0
node 13.12.0
yarn 1.22.4
npm 6.14.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershas 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