A tsconfig.json decides how strictly TypeScript checks your code and what
JavaScript it emits. The same source can be safe or unsafe depending on a handful
of flags. This reference covers the compilerOptions you tune most, with each
flag’s type, default, and concrete effect.
How it works
Compiler options fall into a few jobs. Type-checking flags (the strict
family plus extras like noUncheckedIndexedAccess) change which programs are
accepted. Module flags (module, moduleResolution, target) change how
imports resolve and what runtime features survive. Emit flags
(declaration, sourceMap, outDir, noEmit) change what files are written.
Setting strict: true is shorthand for enabling its whole family. The reference
marks which flags belong to that family so you can see exactly what strict mode
implies and decide whether to layer on the non-strict extras.
Tips
For a browser app bundled by Vite or esbuild, a sensible base is
target: "ESNext", module: "ESNext", moduleResolution: "bundler",
strict: true, and noEmit: true (the bundler does the emit). Add
noUncheckedIndexedAccess and exactOptionalPropertyTypes once the codebase is
clean for an extra safety margin. For a published library, prefer NodeNext
resolution, emit declarations, and keep isolatedModules: true so any
single-file transpiler can build it.