b2KIT

tsconfig.json Generator

Build TypeScript configuration with interactive compiler options, path aliases, and project references.

Tested tool guide Tested browser tools Checked August 16, 2026

What tsconfig.json Generator does, with a checked example

Generates a tsconfig.json from an interactive form: compiler options grouped by module, emit, strictness and interop; a paths table for import aliases; and a references list for project references, with the JSONC preview updating as each control changes. Its real value is not typing JSON, it is that option names and value lists come from TypeScript's option set, so you cannot emit a key tsc does not recognize. The common surprise: tsconfig.json is not strict JSON. Comments and trailing commas are legal, path aliases affect only type checking and never emitted imports, and an omitted key means the TypeScript default applies, not that the option is off.

Worked example

A concrete input and expected output from the current implementation.

Input

Options chosen: target ES2022, module ESNext, moduleResolution Bundler, strict on, outDir dist, rootDir src, alias @/* -> src/*

Expected output

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "strict": true,
    "outDir": "dist",
    "rootDir": "src",
    "paths": {
      "@/*": ["src/*"]
    }
  }
}

Each selection maps to exactly one compilerOptions entry, so the output is fully determined by the choices: strict is a single boolean that turns on the whole strictness family, and paths resolves @/* to src/* relative to the config file (no baseUrl needed since TypeScript 4.1).

How the result is produced

1

Option-to-key mapping

Every toggle corresponds to one key in compilerOptions, and the pickers only offer values TypeScript accepts in combination: moduleResolution "bundler" requires module "esnext" or "preserve", and module "node16"/"nodenext" pair with the matching resolution mode. The preview pane renders the accumulated JSONC so the final file is copy-paste ready, comments and all.

2

Paths and references

The paths table takes a prefix and its substitution (for example @/* and src/*) and emits a paths object; without a baseUrl entry, aliases resolve relative to the tsconfig's own directory, per TypeScript 4.1 behavior. The references section emits a top-level references array and reminds you that each referenced project needs composite: true in its own tsconfig and is rebuilt with tsc -b.

Good uses

  • Bootstrapping a new project: pick target, module, and strict once instead of copying a config from a tutorial that may be years out of date.
  • Adding @/ aliases to a codebase whose imports are long relative paths; the generated paths block must then be mirrored in the bundler's resolve.alias or in tsconfig-paths for Node.
  • Structuring a monorepo: emit references entries for shared packages, set composite on each, and build everything from the root with tsc -b.

Limits and checks

  • Aliases do not touch output: emitted JavaScript keeps the relative import paths. If the running code cannot find @/ modules, the fix belongs in the bundler or Node loader, not in this file.
  • Blank form fields emit no key at all, so the TypeScript default applies: target ES3, module CommonJS, strict off. A config that validates is not the same as a config whose defaults you know.
  • Discovery is positional. tsc uses the nearest tsconfig.json walking up from each file, so a generated config placed in a subfolder governs only that subtree and is never merged with an ancestor config unless it extends it.

Common questions

I generated paths for @/* but the compiled output still imports ./src/... - is the config wrong?

No, the config is doing its only job. paths is a type-level alias used by tsc and your editor; it never rewrites imports in emitted JavaScript. Point your bundler's alias config (or tsconfig-paths for Node) at the same mapping, and keep the two in sync, or the alias will work in the editor and fail at runtime.

Does the generated file need baseUrl for paths to work?

Not since TypeScript 4.1. Without baseUrl, path aliases resolve relative to the folder containing tsconfig.json, which is usually what you want in a single-package project. Many older templates still emit baseUrl: '.', which is harmless but no longer necessary, so do not treat its absence as an error.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools