Enforce type definitions to consistently use either interface or type.
This rule applies only to .js and .ts files.
// code-linter.json5
{
"rules": {
"@typescript-eslint/consistent-type-definitions": "error"
}
} // The definition of a basic type can use type.
export type T1 = string;
// By default, you are advised to define an object type as interface.
export interface T2 {
x: number;
}
export type Foo = string | T2; // By default, you are advised to define an object type as interface.
type T = { x: number }; plugin:@typescript-eslint/all
For details about how to configure Code Linter check rules, see Code Linter.