Lesson 2 of 56 · Typescript
The TypeScript Compiler & tsconfig.json
Duration: 15 minutes
Understanding tsc and tsconfig.json
The TypeScript compiler (tsc) reads tsconfig.json to determine which files to compile and which JavaScript features to target.
Key compilerOptions
| Option | Description |
|---|---|
target | ECMAScript version of the emitted code (ES2022, ESNext). |
module | Module system (CommonJS, ESNext). |
strict | Enables all strict type‑checking options (noImplicitAny, strictNullChecks, …). |
sourceMap | Generates .map files for debugging. |
declaration | Emits .d.ts declaration files (useful for libraries). |
paths & baseUrl | Configure module aliasing. |
Incremental builds
"incremental": true,
"tsBuildInfoFile": "./.tsbuildinfo"
Turns on faster incremental compilation.
Project References (monorepos)
"references": [{ "path": "../shared" }]
Allows one TS project to depend on another’s compiled output.
Try it out:
npx tsc --watch # recompiles on file changes