TypeScript theorytheory 0/50 · 0%
Tooling · easy

19. tsconfig.json essentials

Configuring how the compiler checks and emits code.

`tsconfig.json` controls compiler behaviour project-wide. Key options include `strict` (enables all strict type-checking flags), `target` (which JS version to emit), `module` (module system), and `outDir`.

json
{
  "compilerOptions": {
    "strict": true,
    "target": "ES2020",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "noUnusedLocals": true,
    "skipLibCheck": true
  },
  "include": ["src"]
}

`strict` bundles flags like `strictNullChecks`, `noImplicitAny`, and `strictFunctionTypes` — enabling it is the recommended default for new projects since it catches far more bugs. `skipLibCheck` speeds up compilation by skipping type-checking of `.d.ts` files from dependencies.

Check your understanding

  1. 1. What does enabling `strict: true` do?

  2. 2. What does `target` control?

  3. 3. What does `skipLibCheck` do?