0Pricing
TypeScript Academy · Lesson

Type-Only Imports and Exports

Use import type to avoid runtime overhead.

Welcome

Type-only imports and exports (import type / export type) were introduced in TypeScript 3.8 to give developers explicit control over what is a runtime dependency and what is only a type.

Why Type-Only Matters

Regular imports may include runtime code. If you only need the type, the import can be erased entirely from the compiled output.
import { User } from './models'; // includes runtime binding
import type { User } from './models'; // compile-time only, erased

All lessons in this course

  1. ES Module Syntax: import and export
  2. Re-exports and Barrel Files
  3. Type-Only Imports and Exports
  4. Namespaces vs Modules: Modern Usage
← Back to TypeScript Academy