@typescript-eslint/no-empty-interface

Disallow interfaces that declare no members

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#

Reported:

interface Options {}

interface User {
  name: string;
}

interface Admin extends User {}

Not reported:

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.
interface User {
  name: string;
}

interface Admin extends User {}