ES Modules in TypeScript
ES modules let you split TypeScript code into files that import and export values. Learn the syntax, how TypeScript adds type checking, and how to set up your first multi-file project.
Type-safe JavaScript with TypeScript
ES modules let you split TypeScript code into files that import and export values. Learn the syntax, how TypeScript adds type checking, and how to set up your first multi-file project.
Named exports let you share multiple values and types from a single TypeScript module. Learn every named export pattern and how TypeScript enforces correct usage across files.
Type-only imports tell TypeScript and your bundler that an import is only needed at compile time. Learn import type, inline type specifiers, and when each style matters.
Barrel files consolidate multiple module exports into a single import path. Learn how to create them, when they help, and the performance and circular-dependency traps to avoid.
Path aliases let you replace long relative import paths with short, meaningful names. Learn how to configure tsconfig paths, use wildcards, and avoid common pitfalls.
Module resolution is how TypeScript finds the file behind an import path. Learn how bundler, nodenext, and node16 resolution work, and how to pick the right one.
A well-organized folder structure makes a TypeScript project easier to navigate, build, and scale. Learn practical patterns for src, types, tests, and monorepos.
Circular imports happen when two modules depend on each other, causing runtime errors or incomplete values. Learn how to detect, break, and prevent import cycles.
Common module import mistakes in TypeScript can cause compile errors, runtime crashes, and confusing type behavior. Learn what to avoid and how to fix each mistake.
Declaration files (.d.ts) describe the shape of JavaScript code so TypeScript can type-check it. Learn what they are, how they work, and when to use them.
Global declarations add types to the global scope in TypeScript. Learn how to declare global variables, augment built-in types, and extend window with declare global.
Module augmentation lets you add new types to existing modules without modifying their source code. Learn how to extend third-party packages and your own modules with declare module.