Notes de Jérôme Prudent
Notes publiques ...

« Notes

import type

Créée le 21 May 2026

typescript

  • #typescript
  • import type { Block } from "./types";
  • import {Foo, type Block} from "./types";
  • Imports only types (interface, alias, …)
  • The compiler removes it in the emitted JS
  • Imported type can’t be used at runtime with instanceof
  • It produces smaller outputs: bundlers can drop it
  • It avoids circular dependency issues: type-only imports don’t create a runtime dependency edge.