Glossary / tsconfig

tsconfig

tsconfig.json configures TypeScript project scope, type checking, module interpretation, output, and compiler behavior. A good configuration makes the type checker model the actual runtime and build pipeline; mismatched module or library settings can let code type-check while failing after deployment.

Project and inheritance

files, include, and exclude determine which files form the project, while extends shares a base config. Relative paths are interpreted relative to the config in which they appear, which matters in monorepos. references enables project-reference builds for larger repositories. tsc -p selects a project config; command-line file arguments can change how project configuration is applied, so use intentional scripts.

Important settings include strict, target, lib, module, moduleResolution, jsx, noEmit, declaration, rootDir, outDir, and paths. paths is a type-checker mapping and does not automatically rewrite runtime imports; configure the bundler/runtime consistently. skipLibCheck can speed builds but may hide incompatible declarations.

Configuration strategy

Start from strict checking and explicit runtime targets, then relax only for a documented reason. Separate app, test, and library configs when their emit and globals differ. Keep generated output outside source inclusion to avoid accidental rechecking. In monorepos, use project references where incremental boundaries provide real value and keep shared config versioned.

Interview questions

  1. Does paths change JavaScript output? No; it informs TypeScript resolution unless another tool implements the mapping.
  2. What does lib control? Available ambient declarations for standard/runtime APIs.
  3. noEmit use case? Run TypeScript as a checker while another tool handles transpilation.
  4. Why separate configs? Different environments may have different globals, emit requirements, or project boundaries.
  5. What does skipLibCheck trade off? Faster checking for less verification of declaration files.

References