TypeScript
/Beginner
tsconfig.json
Definition
The configuration file that indicates that a directory is the root of a TypeScript project. It specifies the root files and the compiler options required to compile the project.
Explain Like I'm New
The `tsconfig.json` is the rulebook for the TypeScript Sheriff. It tells the compiler exactly how strict it should be, what files it should ignore (like `node_modules`), and what 'flavor' of JavaScript it should output (like old ES5 for Internet Explorer, or modern ES2022).
Real World Example
Running `tsc --init` in a terminal creates a blank `tsconfig.json`. Changing `"target": "ES6"` tells the compiler to leave Arrow Functions alone, rather than compiling them down to `function() {}` for old browsers.
Common Use Cases
- •Project setup
- •Adjusting compiler strictness
- •Excluding test files from the build
Interactive Example
Loading...
Console output will appear here...
Interview Questions
basic
- What command generates a default `tsconfig.json`?
intermediate
- What is the difference between `include` and `exclude`?
advanced
- What does the `extends` property do in a tsconfig?