Docs
/
TypeScript
Chapter 1
01 — Setup & Configuration
Core Concepts
- TypeScript compiles (transpiles)
.tsfiles to plain JavaScript viatsc - tsconfig.json is the project configuration file — controls compiler behavior
- Strict mode enables all strict type-checking flags at once
targetsets the JS version output (ES5, ES2015, ES2022, ESNext)modulesets the module system (CommonJS, ESNext, NodeNext)outDir/rootDircontrol where compiled JS goeswatchmode recompiles automatically on savestrict: trueenables: strictNullChecks, noImplicitAny, strictFunctionTypes, strictBindCallApply, etc.
Key tsconfig Options
| Option | Purpose |
|---|---|
target | JS output version |
module | Module system (CJS, ESM) |
strict | Enable all strict checks |
outDir | Output directory for compiled JS |
rootDir | Root directory of source files |
declaration | Generate .d.ts files |
sourceMap | Generate source maps for debugging |
esModuleInterop | Better CJS/ESM interop |
skipLibCheck | Skip type-checking .d.ts files |
noEmit | Type-check only, don't output JS |
When to Use
- Any project longer than a script — use TypeScript
- Always start with
strict: trueand only relax if needed - Use
noEmit: truewhen a bundler (Vite, webpack) handles compilation