Question presented to candidate:
"What is tsconfig.json for, and if you were setting up a new project, which compiler options would you actually care about and why?"
What a strong answer should cover:
tsconfig.jsonmarks the project root and is read by bothtscand the editor;include,exclude,files,extends,referencesstrict(always on) and extra checks such asnoUncheckedIndexedAccess- The environment options and how they differ:
targetchanges emitted syntax,libonly changes which APIs the checker knows,moduleandmoduleResolutiondescribe imports - Output options:
outDir/rootDir,declaration,sourceMap,noEmitwhen a bundler builds the code, plusskipLibCheckfor speed - Defaults change across versions (
tsc --initin 5.9, compiler defaults in 6.0), so set key options explicitly and inspect withtsc --showConfig
Clarifying questions expected:
- Is this an app built by a bundler, or code that
tsccompiles for Node.js or a published library? - Which runtime and JavaScript version must the output support?
Code / implementation expected: Optional β a short tsconfig for a stated kind of project, with each option justified.