tsconfig.json generator

Pick a preset for Node, a Vite browser app or a library, then turn on the strictness flags you want. With comments on, every option is explained in one line, so you can keep what you understand and delete the rest.

Preset

tsconfig.json may contain comments, which TypeScript and most editors accept; strict JSON parsers do not, so turn comments off if another tool reads the file. Adjust target and lib to the runtime you ship to.

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Choose the preset that matches where your code runs.
  2. Switch the strictness flags on or off. Start with strict and add the others as the code base allows.
  3. Set the source folders and, for Node, the output folder.
  4. Copy the result into tsconfig.json in your project root.

What the presets do

  • Node uses module and moduleResolution set to NodeNext, so imports behave as in Node, and loads only Node types.
  • Browser (Vite) uses moduleResolution: bundler, isolatedModules and noEmit, because Vite transpiles the files itself.
  • Library emits declarations and declaration maps so TypeScript users get your types.

Example

Node with the defaults gives ES2022 output into dist, strict, noUncheckedIndexedAccess, noImplicitOverride, noFallthroughCasesInSwitch and source maps, each preceded by a comment.

Tips

  • Turning on a flag in an existing project can produce many errors at once; add flags one at a time.
  • skipLibCheck speeds up builds but can hide type errors inside dependencies.

Frequently asked questions

What does strict turn on?

It enables a group of checks: noImplicitAny, strictNullChecks, strictFunctionTypes, strictBindCallApply, strictPropertyInitialization, noImplicitThis, useUnknownInCatchVariables and alwaysStrict. New projects should normally start with it on.

Is noUncheckedIndexedAccess part of strict?

No. It is a separate flag that makes array[i] and record[key] possibly missing, which catches out-of-range reads but needs extra checks in code. The same is true of exactOptionalPropertyTypes and noImplicitOverride.

Which preset should I choose?

Node is for code run by Node and compiled with tsc. Browser (Vite) is for apps bundled by Vite or a similar tool: it only type-checks (noEmit) and uses bundler module resolution. Library emits declarations (.d.ts) next to the JavaScript.

Why does the file contain comments?

tsconfig.json is parsed as JSON with comments (JSONC) by TypeScript. If a tool that needs plain JSON reads it, switch the comments option off.

Do I need to change target and lib?

Often. The presets use ES2022 (ES2020 for the library) as sensible examples. Set target to the oldest runtime you must support.

More in Developer

All tools in this category: Developer ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.