What is the tsconfig.json file?

Why Interviewers Ask This

This is a classic screening question for TypeScript roles. Hiring managers ask it early in interviews to gauge your baseline understanding and determine if you can communicate technical concepts clearly.

Answer

The tsconfig.json is the configuration file for the TypeScript compiler. It is placed in the project root and controls how TypeScript compiles your code. Key compiler options: "target" — which JavaScript version to compile to (e.g., "ES5", "ES2020", "ESNext"). "module" — module system ("commonjs" for Node, "ESNext" for bundlers). "strict" — enables all strict type checks (highly recommended). "outDir" — where to put compiled JavaScript files. "rootDir" — root of source files. "include"/"exclude" — file patterns to compile or skip. "lib" — which built-in type definitions to include (e.g., "DOM", "ES2022"). "sourceMap": true — generates source maps for debugging. "noEmit": true — type-check only without generating files (used with bundlers). "paths" — module path aliases. "baseUrl" — base for non-relative imports. Use tsc --init to generate a starter tsconfig.json with all options commented.

Pro Tip

Demonstrate both theoretical understanding and practical experience. Say what it is, then give an example of how you actually used it in a TypeScript codebase.