目录

@typescript-eslint/consistent-type-imports

Enforce consistent usage of type imports.

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

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@typescript-eslint/consistent-type-imports": "error"
  }
}

Options

For details, see @typescript-eslint/consistent-type-imports.

Example of Correct Code

// By default, import type Foo from '...' is recommended.
import type { Foo } from 'Foo';
import type Bar from 'Bar';
export type T = Foo;
export const x: Bar = 1;

Example of Incorrect Code

// By default, import type Foo from '...' is recommended.
import { Foo } from 'Foo';
import Bar from 'Bar';
export type T = Foo;
export const x: Bar = 1;

Rule Set

plugin:@typescript-eslint/recommended
plugin:@typescript-eslint/all

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