Skip to content

no-empty-object-type

Reports the type {} (also in type T = {}) and an interface with no members that extends at most one type. {} in an intersection ({} & X) and an interface that extends two types are not reported.

{} does not mean an empty object: it accepts every value except null and undefined, numbers and strings included. An empty interface that only extends one type is the same as that type.

To fix, write object for any non-primitive, unknown for any value, Record<string, never> for an empty object, or the type itself.

Reported
...
type A = {};
type B = {} & { a: 1 };
interface C {}
interface D extends A {}
interface E extends A, B {}
interface F { a: 1 }
...
js:
lint:
rules:
no-empty-object-type: warn # off (default), warn, error

Enabled by the presets: js/typescript-eslint-recommended, js/biome-recommended.

Suppress one line with sudsy-disable-next-line no-empty-object-type in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
typescript-eslint no-empty-object-type partial the options (allowInterfaces, allowObjectTypes, allowWithName) keep their defaults