目录

@typescript-eslint/consistent-indexed-object-style

Require or disallow the Record type.

This rule applies only to .js and .ts files.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@typescript-eslint/consistent-indexed-object-style": "error"
  }
}

Options

For details, see @typescript-eslint/consistent-indexed-object-style.

Example of Correct Code

// The Record type is recommended by default.
export type Foo = Record<string, unknown>;

Example of Incorrect Code

export interface Foo1 {
// The Record type is recommended by default.
  [key: string]: unknown;
}

export type Foo2 = {
// The Record type is recommended by default.
  [key: string]: unknown;
};

Rule Set

plugin:@typescript-eslint/all

For details about how to configure Code Linter check rules, see Code Linter.