目录

@typescript-eslint/no-empty-interface

Disallow the declaration of empty interfaces.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@typescript-eslint/no-empty-interface": "error"
  }
}

Options

For details, see @typescript-eslint/no-empty-interface.

Example of Correct Code

// an interface with any number of members
interface Foo {
  name: string;
}

interface Bar {
  age: number;
}

// an interface with more than one supertype
// in this case the interface can be used as a replacement of an intersection type.
export interface Baz extends Foo, Bar {}

Example of Incorrect Code

// an empty interface
interface Foo {}

// an interface with only one supertype (Bar === Foo)
export interface Bar extends Foo {}

// an interface with an empty list of supertypes
export interface Baz {}

Rule Set

plugin:@typescript-eslint/all

For details about how to configure Code Linter check rules, see Code Linter.