close

no-empty-interface

Configuration

rslint.config.ts
import { defineConfig, ts } from '@rslint/core';

export default defineConfig([
  ts.configs.recommended,
  {
    rules: {
      '@typescript-eslint/no-empty-interface': 'error',
    },
  },
]);

Rule Details

Disallows empty interface declarations. An empty interface with no members is equivalent to the empty object type {}. An empty interface that extends a single interface is equivalent to a type alias of that interface. In both cases, the interface declaration adds unnecessary indirection and can be replaced with a simpler construct.

Examples of incorrect code for this rule:

// Empty interface is equivalent to {}
interface Foo {}

// Equivalent to: type Bar = Baz
interface Bar extends Baz {}

Examples of correct code for this rule:

// Interface with members
interface Foo {
  name: string;
}

// Interface extending multiple interfaces
interface Bar extends Baz, Qux {}

// Type alias instead of empty extending interface
type Bar = Baz;

Original Documentation