typeImports
Reports imports that should use 'import type' syntax.
✅ This rule is included in the ts stylistic presets.
Using import type for type-only imports improves tree-shaking and makes the intent explicit.
When an import is only used in type positions (type annotations, interfaces, type aliases),
it should use import type syntax.
Examples
Section titled “Examples”Type-Only Named Import
Section titled “Type-Only Named Import”import { User } from "./types";type Admin = User & { isAdmin: boolean };import type { User } from "./types";type Admin = User & { isAdmin: boolean };Type Annotations
Section titled “Type Annotations”import { Config } from "./config";function setup(config: Config): void {}import type { Config } from "./config";function setup(config: Config): void {}Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If you prefer not to distinguish between type and value imports, you can disable this rule.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.