Home › Developer Tools › tsconfig.json Generator

tsconfig.json Generator

Choose a starting preset, adjust the compiler options and get a clean tsconfig.json with comments. Every option you enable is explained in plain words, and conflicting settings such as a module and moduleResolution mismatch are flagged before tsc complains.

Last updated:

Language & modules
Type checking
Interop & JavaScript
Emit
Paths & files

tsconfig.json

    What each option does
    Advertisement
    Advertisement

    How to use the tsconfig.json Generator

    1. Pick a preset that matches your project: Node.js ESM or CommonJS, a React + Vite app, a publishable library or the strictest setup.
    2. Adjust language and modules: the JavaScript target, built-in libs, module format and resolution strategy, and JSX mode.
    3. Choose type checks and emit options such as strict, noUncheckedIndexedAccess, outDir, declaration files and source maps.
    4. Add path aliases like @/* ./src/* and set include/exclude folders.
    5. Read the notes and explanations, then copy or download tsconfig.json into your project root and run npx tsc --noEmit.

    Matching module and moduleResolution

    Most confusing tsconfig errors come from a module and moduleResolution pair that does not fit how the code actually runs. These combinations are the ones TypeScript recommends:

    ProjectmodulemoduleResolutionTypical extras
    Node.js runs the compiled JS (ESM or CJS)NodeNextNodeNext (or omit)outDir, types: ["node"], .js extensions in imports
    App built by Vite, webpack, esbuild, ParcelESNext or PreserveBundlernoEmit, isolatedModules, jsx
    Older CommonJS-only Node.js projectCommonJSNode10esModuleInterop
    Library published to npmNodeNextNodeNextdeclaration, declarationMap, sourceMap
    Code run by tsx, ts-node, Bun or DenoPreserve or ESNextBundlernoEmit, allowImportingTsExtensions

    Choosing a target

    targetNotable syntax kept as-isGood for
    ES2017async / awaitOlder browsers and Node 8+
    ES2020optional chaining ?., nullish ??, BigIntEvergreen browsers, Node 14+
    ES2022class fields, #private, top-level await, .at()Node 16.11+ / 18+, current browsers
    ES2023+array findLast, toSorted and similar APIs (via lib)Node 20+ and recent browsers
    ESNextEverything the TypeScript version supportsCode that another tool transpiles later

    Remember that target changes syntax only. Runtime APIs such as Array.prototype.at are not polyfilled; lib merely declares that they exist.

    Tips for a healthy config

    • Start strict. Enabling strict on day one costs little; adding it to a large existing code base can surface hundreds of errors.
    • Use extends for shared settings. Monorepos often keep a tsconfig.base.json and let each package use "extends": "../../tsconfig.base.json".
    • Check what is included. npx tsc --listFilesOnly prints every file in the program, and npx tsc --showConfig prints the final merged options.
    • Keep build and type-check apart. In bundled apps, let the bundler emit JavaScript and run tsc --noEmit in CI to catch type errors.

    Frequently asked questions

    What is tsconfig.json?

    tsconfig.json is the configuration file of a TypeScript project. Its compilerOptions tell the TypeScript compiler (tsc) and your editor which JavaScript version to emit, how modules are resolved and which type checks to run, while include and exclude decide which files belong to the project.

    Which moduleResolution should I use?

    Use NodeNext (with module NodeNext) for code that Node.js runs directly, because it follows Node's real rules including package.json exports and required .js extensions. Use Bundler (with module ESNext or Preserve) for apps built by Vite, webpack, esbuild or similar tools. Node10 is the legacy CommonJS algorithm and ignores exports maps.

    What does strict: true enable?

    strict turns on a family of checks: strictNullChecks, noImplicitAny, strictFunctionTypes, strictBindCallApply, strictPropertyInitialization, noImplicitThis, useUnknownInCatchVariables and alwaysStrict. New strict options added in later TypeScript versions are included automatically. Extra checks such as noUncheckedIndexedAccess are not part of strict and must be enabled separately.

    Why do my path aliases work in the editor but fail at runtime?

    paths only tells TypeScript how to find types; tsc does not rewrite import paths in the emitted JavaScript. Configure the same alias in your bundler (for example Vite resolve.alias), use package.json imports with # aliases, or a runtime helper such as tsconfig-paths.

    Do I need baseUrl for paths?

    No. Since TypeScript 4.1, paths can be used without baseUrl and are resolved relative to the tsconfig.json file. baseUrl also makes every bare import resolvable from that folder, which can hide mistakes, so new projects usually leave it out.

    Why does TypeScript ask for .js extensions in my imports?

    With module and moduleResolution set to Node16 or NodeNext, ES module files follow Node.js rules, which require full relative paths. You write import './util.js' even though the source file is util.ts, because that is the file that will exist after compilation.

    Can a tsconfig.json contain comments?

    Yes. TypeScript reads tsconfig.json as JSON with comments, so // and /* */ comments and trailing commas are accepted. Some other tools that read the file as strict JSON may not accept comments; turn the Comments option off if you need plain JSON.

    Are all the tools on FreeToolCabin tested for quality and accuracy?

    Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

    Related tools

    package.json GeneratorFill a form and get a valid, npm-ready package.json with scripts, dependencies and checks.JSON to TypeScriptGenerate TypeScript interfaces or types from JSON, with nested types and optional fields.Gitignore GeneratorBuild a .gitignore from 50+ templates for languages, frameworks, IDEs and OS, merged and deduped.Dockerfile GeneratorGenerate a production Dockerfile and .dockerignore for Node, Python, Go or a static nginx site.QR Code GeneratorMake QR codes for links, Wi-Fi, email and more.Barcode GeneratorCreate Code 128, EAN-13, UPC-A, EAN-8, Code 39 and ITF-14 barcodes as PNG or SVG.UUID GeneratorGenerate UUID v4 and v7 / GUIDs in bulk and copy or download them.Schema Markup Generator (JSON-LD)Create JSON-LD structured data for FAQ, Product, Article and more.Htaccess & Nginx Redirect GeneratorBuild 301 redirects for .htaccess, Nginx and Netlify or Cloudflare _redirects.Fake Data GeneratorGenerate mock data as JSON, CSV or SQL.Random String GeneratorGenerate secure random strings and tokens in bulk with any length and character set.API Key GeneratorCreate secure API keys and secrets with prefixes, checksums and SHA-256 hashes for storage.MIME Type LookupFind the MIME type for any file extension, or the extensions for a MIME type, in 400+ entries.Cron Expression GeneratorBuild crontab schedules visually, read them in plain English and see the next run times.URL Slug GeneratorTurn titles into clean, SEO-friendly URL slugs: accents, stop words, separators and bulk lines.JSON Schema GeneratorTurn sample JSON into a draft 2020-12 JSON Schema with types, required fields and formats.License GeneratorCreate a LICENSE file for MIT, Apache, GPL, BSD, ISC, MPL or Unlicense with your name and year.ULID GeneratorGenerate sortable ULIDs and UUID v7 in bulk, monotonic option, and decode their timestamps.Htpasswd GeneratorCreate .htpasswd entries with bcrypt, APR1-MD5 or SHA-1 for Apache and Nginx basic auth.Placeholder Image GeneratorCreate placeholder images in any size, color and text as PNG, JPG, WebP, SVG or data URI.Ads.txt GeneratorCreate or validate ads.txt and app-ads.txt files: seller lines, cert IDs and variables.Docker Run to Compose ConverterConvert docker run commands to docker-compose.yml, or a compose file back to docker run.HTML Boilerplate GeneratorTick the options you need and get a clean HTML5 starter template with meta, OG tags and CSS reset.JSON to Zod SchemaInfer a Zod (or Yup) schema from sample JSON with optional, nullable and z.infer types.Linux Commands Cheat SheetSearchable Linux and bash command reference with flags explained, examples and copy buttons.LLMs.txt GeneratorBuild an llms.txt file for AI crawlers: summary and link sections, import from your sitemap.Nano ID GeneratorGenerate secure Nano IDs with custom alphabet, length and count, plus a collision calculator.Nginx Config GeneratorBuild an nginx server block: static site, SPA, reverse proxy or PHP, with SSL, gzip and redirects.OpenAPI / Swagger ViewerView OpenAPI 2/3 JSON or YAML as interactive API docs with validation and an endpoint list.PKCE Code Challenge GeneratorGenerate an OAuth 2.0 PKCE code_verifier and S256 code_challenge, build auth URLs, verify pairs.README GeneratorFill in a form and get a polished README.md with badges, install, usage and license, live preview.Regex GeneratorBuild regular expressions visually from blocks or presets (email, date, phone) and test them live.Commit Message GeneratorBuild Conventional Commit messages with type, scope, body, breaking change and issue refs.Database Schema DesignerDesign tables and relationships visually, then export SQL for MySQL, PostgreSQL or SQLite.Docker Compose GeneratorBuild a docker-compose.yml with a form: services, ports, volumes, env, healthchecks and presets.Dummy File GeneratorCreate test files of an exact size in KB, MB or GB with zeros, random bytes or text.FFmpeg Command GeneratorPick a task and options, get the exact ffmpeg command with every flag explained.Folder Tree GeneratorTurn a local folder or an indented list into an ASCII directory tree for your README.Changelog GeneratorTurn Conventional Commit messages into a grouped Keep a Changelog Markdown file per version.cURL Command BuilderBuild curl commands from a form: method, headers, query, JSON or form body, auth and flags.Docker Compose to KubernetesConvert docker-compose.yml into Kubernetes Deployment, Service, ConfigMap and PVC manifests.Docker Compose ValidatorCheck a docker-compose.yml for YAML errors, schema mistakes, broken references and deprecated keys.Dockerfile LinterLint a Dockerfile for best practices: pinned tags, apt cleanup, non-root USER and layer count.Dockerignore GeneratorBuild a .dockerignore from Node, Python, Go and Java templates, plus your own entries.ESLint Config GeneratorGenerate a flat eslint.config.js for JavaScript, TypeScript, React or Node with rule presets.Git Branch Name GeneratorTurn a ticket ID and title into a clean, valid git branch name like feature/PROJ-12-add-login.GitLab CI Config GeneratorGenerate a .gitlab-ci.yml with stages, jobs, images, cache, artifacts and rules from templates.Jinja2 Template TesterRender Jinja2 templates with YAML or JSON variables using real Jinja2, with clear error lines.JSON Schema Mock Data GeneratorGenerate realistic sample JSON from a JSON Schema: formats, patterns, $ref, seeds and counts.Kubernetes Secret GeneratorCreate Kubernetes Secret YAML from key/value pairs or .env with auto base64, or decode one.Kubernetes YAML ValidatorValidate Kubernetes manifests against the API schema of a chosen version, with error paths.Prettier Config GeneratorToggle Prettier options, preview formatted code live and copy your .prettierrc file.Quartz Cron GeneratorBuild and explain Quartz and Spring cron expressions with seconds, ?, L, W and #, plus next fire times.README Badge GeneratorCreate Shields.io-style README badges for license, version, build and custom labels.Systemd Service File GeneratorCreate a systemd .service unit with ExecStart, user, restart policy, environment and hardening.Access Log AnalyzerAnalyze Apache and Nginx access logs: top URLs, IPs, status codes, bots and traffic charts.Regex String GeneratorGenerate random test strings that match any regular expression, checked against the real regex.ASCII Table GeneratorTurn CSV or pasted cells into plain-text tables: MySQL, Markdown, Unicode box and reST styles.GitHub Actions Workflow GeneratorBuild a GitHub Actions CI workflow: triggers, matrix, caching, tests, Pages or Docker deploy.Kubernetes YAML GeneratorGenerate Deployment, Service, Ingress, ConfigMap, Secret and HPA manifests with safe defaults.Markdown TOC GeneratorGenerate a linked table of contents from Markdown headings with GitHub-style anchors.OpenAPI EditorEdit OpenAPI/Swagger YAML or JSON side by side with live API docs, validation and download.OpenAPI ValidatorValidate OpenAPI 3.0/3.1 and Swagger 2.0 specs: schema errors, broken $refs, line numbers.Pivot Table MakerBuild pivot tables from CSV or Excel by drag and drop: sum, count, average, charts, export.SQL Query BuilderBuild SELECT queries visually: joins, filters, GROUP BY, ORDER BY and LIMIT, as clean SQL.Truth Table GeneratorType a logic expression and get its full truth table, minterms and canonical DNF/CNF.TypeScript PlaygroundWrite TypeScript with live type checking, see the compiled JavaScript and run it in your browser.Article Schema GeneratorCreate Article, BlogPosting or NewsArticle JSON-LD with headline, authors, dates and images.
    See all 85 Code Generators & Builders →