Docs
/
TypeScript
Chapter 1

01 — Setup & Configuration

Core Concepts

  • TypeScript compiles (transpiles) .ts files to plain JavaScript via tsc
  • tsconfig.json is the project configuration file — controls compiler behavior
  • Strict mode enables all strict type-checking flags at once
  • target sets the JS version output (ES5, ES2015, ES2022, ESNext)
  • module sets the module system (CommonJS, ESNext, NodeNext)
  • outDir / rootDir control where compiled JS goes
  • watch mode recompiles automatically on save
  • strict: true enables: strictNullChecks, noImplicitAny, strictFunctionTypes, strictBindCallApply, etc.

Key tsconfig Options

OptionPurpose
targetJS output version
moduleModule system (CJS, ESM)
strictEnable all strict checks
outDirOutput directory for compiled JS
rootDirRoot directory of source files
declarationGenerate .d.ts files
sourceMapGenerate source maps for debugging
esModuleInteropBetter CJS/ESM interop
skipLibCheckSkip type-checking .d.ts files
noEmitType-check only, don't output JS

When to Use

  • Any project longer than a script — use TypeScript
  • Always start with strict: true and only relax if needed
  • Use noEmit: true when a bundler (Vite, webpack) handles compilation