Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

Latest commit

 

History

History
34 lines (23 loc) · 639 Bytes

prefer-interface.md

File metadata and controls

34 lines (23 loc) · 639 Bytes

Prefer an interface declaration over a type literal (type T = { ... }) (prefer-interface)

Interfaces are generally preferred over type literals because interfaces can be implemented, extended and merged.

Rule Details

Examples of incorrect code for this rule.

type T = { x: number };

Examples of correct code for this rule.

type T = string;
type Foo = string | {};

interface T {
    x: number;
}

Options

{
    "interface-over-type-literal": "error"
}

Compatibility