0Pricing
TypeScript Academy · Lesson

ES Module Syntax: import and export

Use named and default exports in TypeScript files.

Welcome

TypeScript supports ES module syntax for organizing code into separate files. This lesson covers named exports, default exports, and imports.

Named Exports

Use `export` to make a declaration available to other files.
// math.ts
export function add(a: number, b: number): number { return a + b; }
export const PI = 3.14159;
export interface Config { host: string; }

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