Imports and Exports
- ES module syntax. TypeScript speaks standard modules: export marks what a file offers, import pulls it in by name.
- Type-only imports. import type brings in types alone: erased at build time, leaving no runtime dependency behind.
- Barrel files. A barrel re-exports a folder through one index: convenient, and a circular-import trap when overused.
Module Resolution
- How imports resolve. Module resolution is the compiler’s file hunt: relative paths, package names, and the configured strategy.
- Path aliases. Path aliases like @app/orders shorten deep imports: configured once in tsconfig, understood by tooling.
- Node versus bundler. The resolution mode must match your runtime: Node rules and bundler rules disagree about extensions.
Organising Large TypeScript Systems
- Feature folders. Organise by feature, not by kind: an orders folder holding its types, logic and tests changes together.
- Public surfaces. Each feature exports a deliberate surface; everything else stays internal and freely changeable.
- Project references. Project references split a monorepo into typed units that build incrementally and forbid undeclared edges.
Before and after this level
- Before: Level 7: Classes & Object Design: Classes and Access Modifiers, Abstract Classes and Interfaces, Composition and Typed Domain Models.
- Next: Level 9: Compiler & Configuration: tsconfig, Strictness and Compiler Options, Build Targets and Module Formats.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does TypeScript Level 8: Modules & Projects cover?
Imports and Exports, Module Resolution, Organising Large TypeScript Systems: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 7: Classes & Object Design, which covers Classes and Access Modifiers, Abstract Classes and Interfaces, Composition and Typed Domain Models.