Advertisement
Beginner TypeScript, tsconfig & Compiler Options

What is the purpose of the tsconfig.json file, and what does the 'compilerOptions' key control?

Short answer

tsconfig.json marks a directory as the root of a TypeScript project and configures how the compiler behaves — 'compilerOptions' specifically holds settings controlling type-checking strictness, the JavaScript output target/format, module resolution, and where compiled files are…

Save TypeScript mock interview
Advertisement
AModel answer
tsconfig.json marks a directory as the root of a TypeScript project and configures how the compiler behaves — 'compilerOptions' specifically holds settings controlling type-checking strictness, the JavaScript output target/format, module resolution, and where compiled files are written.
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "commonjs",
    "outDir": "./dist",
    "strict": true
  },
  "include": ["src/**/*"]
}
Real-world example
Setting up a new TypeScript project's baseline configuration for compiling and type-checking source files.
Likely follow-ups
  • What happens if you run 'tsc' in a directory with no tsconfig.json present at all?
Related topics