Skip to main content

TypeScript analyzer

TypeScript Import Discipline

Surfaces import-statement hygiene: type-only annotations, namespace imports, barrel files, and import-style consistency.

patterns ts-import-discipline

TypeScript Import Discipline

Surfaces import-statement hygiene: type-only annotations, namespace imports, barrel files, and import-style consistency.

TypeScript-aware imports (import type, side-effect-free re-exports, narrow named imports) make codebases faster to compile, easier to refactor, and friendlier to tree-shaking. The analysis flags imports that miss type annotations, use heavy namespace forms, or hide behind barrel files that obscure dependency relationships.

Severity guide

info
Import style is acceptable but could be tightened.
warning
Imports are interfering with type-only optimizations or tree-shaking.
critical
Not currently emitted by this analysis.

Remediation

Add `import type` where bindings are types only, prefer named imports over namespace imports, and reduce barrel-file indirection.

Add import type where bindings are types only, prefer named imports over namespace imports, and reduce barrel-file indirection.

Documentation