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
- ES Module Syntax: import and export
- Re-exports and Barrel Files
- Type-Only Imports and Exports
- Namespaces vs Modules: Modern Usage