@typescript-eslint/no-empty-interface

Disallow interfaces that declare no members

deprecatedfixable

Also called typescript-eslint/no-empty-interface, typescript/no-empty-interface

An interface with no members checks almost nothing. interface Options {} accepts every value except null and undefined, the same as {}. An empty interface that extends one other type is only a second name for that type.

An empty interface that extends two or more types isn't reported, because it combines them.

--fix rewrites an empty interface that extends one type to a type alias.

This rule is deprecated. Use @typescript-eslint/no-empty-object-type instead. It reports the same interfaces, and the {} type too.

Examples#

example.ts2 problems
interface Options {}

interface User {
  name: string;
}

interface Admin extends User {}
example.tsNo problems
interface User {
  name: string;
}

interface Timestamps {
  createdAt: Date;
}

type Admin = User;

interface StoredUser extends User, Timestamps {}

Options#

OptionDefaultWhat it does
allowSingleExtendsfalseAllow an empty interface that extends one type.
example.tswith { "allowSingleExtends": true }No problems
interface User {
  name: string;
}

interface Admin extends User {}