tsconfig.json Generator
Choose a preset for Node, browser, library or React, then set strictness, source maps and folders to get a tsconfig.json.
Use the tool
Why this tool exists
The TypeScript compiler has dozens of options, and the right combination depends on where the code runs. A Node service needs NodeNext module resolution, a bundled browser app wants the DOM libraries and no emit, a library needs declaration files, and a React app needs the JSX transform. Copying a config from an unrelated project often leaves you with confusing errors about imports or missing types.
This generator starts from a modern base targeting ES2022 and adjusts it per preset. You decide on strict mode, source maps, the output folder and the source folder. The result is a compact file you can extend. Check it against your bundler or runtime documentation, as module settings must match how your code is actually loaded. Output is created in the browser.
How to use it
- Choose a preset: node, browser, library or react.
- Tick or untick strict and sourceMap.
- Set outDir and the source folder used for rootDir and include.
- Copy the JSON into tsconfig.json and run tsc --noEmit to test it.
Frequently asked questions
Which settings differ between presets?
Node uses NodeNext modules and node types. Browser and React add the DOM libraries and noEmit, leaving output to a bundler. Library turns on declaration files and a rootDir. React also sets the react-jsx transform.
Should I always enable strict?
For new code, yes. It turns on a group of checks, such as no implicit any and strict null checks, that catch real bugs. For a large JavaScript migration you may switch it off at first and tighten later.
Why is outDir missing in browser presets?
Those presets use noEmit because a bundler such as Vite or esbuild produces the output. TypeScript is then used only for type checking, so an output directory is not needed.
Does it cover monorepos or path aliases?
No. Project references, paths and extends are not generated. Add them by hand once the base file works for your package.