TypeScript · Types that pay for themselves
What does tsconfig.json control?
Short answer
tsconfig.json configures the compiler: which files to include, the target and module system, strictness, output and path resolution. It is the contract that keeps editor and build behavior aligned.
The compiler reads tsconfig.json to decide how to check and emit the project. The include and exclude arrays select files, compilerOptions control language level and strictness, and references support project composition. The same file is used by the editor's language service, so a mistake shows up in both places.
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"noEmit": true,
"skipLibCheck": true
},
"include": ["src"]
}Options that matter most
- target sets the JavaScript language level of the output
- module and moduleResolution define the module system and lookup rules
- strict enables the main safety checks
- noEmit lets a bundler or runtime handle output
- skipLibCheck skips checking declaration files for faster builds
- extends shares a base configuration across packages
With a bundler, noEmit is common because the bundler produces the final output. If you rely on tsc to emit, set outDir and rootDir explicitly. Changing target affects emitted syntax, while changing lib affects which global type definitions are available.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1What is the difference between target and lib?
- 2Why use noEmit with a bundler?
- 3What does extends do?
- 4When is skipLibCheck risky?
Say it in the interview
tsconfig.json tells the compiler which files to check and how to emit or resolve them. I care most about target, module, moduleResolution and strict, because those determine the language level and the safety checks. With a bundler I often use noEmit and let the bundler produce output. I extend a shared base config so teams do not drift.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live TypeScript mock interview and get scored feedback on depth, clarity and confidence.