tsconfig.json Generator
NewGenerate a tsconfig.json for Node.js (CommonJS/ESM), React/Vite, or library projects with real, recommended compiler option combinations.
Presets configure real, commonly-recommended compiler option combinations: Node CommonJS uses module: "CommonJS" with moduleResolution: "Node"; Node ESM uses module: "NodeNext"; React/Vite uses module: "ESNext" with jsx: "react-jsx" and moduleResolution: "Bundler"; Library mode adds declaration: true and declarationMap: true for publishing typed packages.
Frequently Asked Questions
Why do the presets use different "module" and "moduleResolution" settings?
Each JavaScript runtime/bundler environment resolves imports differently. Node CommonJS projects need module: "CommonJS" with moduleResolution: "Node" to match how Node has always resolved require()-style imports. Node ESM projects use "NodeNext" for both, matching Node's native ES module resolution rules. Bundler-based projects (React/Vite, library builds) use moduleResolution: "Bundler", which matches how modern bundlers like Vite and esbuild actually resolve imports — using the wrong one for your environment causes confusing "cannot find module" errors that work at runtime but fail type-checking, or vice versa.
What does strict mode actually enable?
TypeScript's strict flag is itself a bundle of several stricter checks (noImplicitAny, strictNullChecks, strictFunctionTypes, and others) — enabling it catches significantly more potential bugs at compile time than the default loose configuration, and is the generally recommended setting for any new TypeScript project.
What's different about the "Library" preset?
It adds declaration: true and declarationMap: true, which generate .d.ts type declaration files (and their source maps) alongside your compiled output — required if you're publishing a package to npm that other TypeScript projects will import and expect type information from.
Why does the React preset set noEmit: true?
Because in a typical Vite/bundler-based React setup, TypeScript is used purely for type-checking — the actual JavaScript output is produced by the bundler (esbuild/Vite), not by tsc directly. Setting noEmit: true tells TypeScript not to also try to write output files, avoiding duplicate/conflicting build output.
Can I edit the generated config further?
Yes — this generates a solid, correct starting point based on real, commonly recommended option combinations, but tsconfig.json supports dozens of additional options (path aliases, incremental builds, project references) you can add afterward based on your project's specific needs.