close
Skip to main content

Generate tsconfig.json from JavaScript

Get a working tsconfig.json for your JavaScript project in one click. JavaScriptConverter analyzes your source — module syntax, JSX usage, target runtime — and emits a tsconfig that compiles on the first try, with no tsc --init guesswork.

Why a hand-written tsconfig usually breaks

tsc --init emits a generic template with most options commented out. Real projects need the right combination of module, moduleResolution, target, and jsx for the specific runtime — Node 22 is different from a Vite app, which is different from a Next.js app, which is different from a library you'll publish to npm.

JavaScriptConverter inspects your source files, detects which world you're in, and writes a tsconfig that matches. No copying snippets from Stack Overflow.

Examples by project type

Node.js backend (ESM)

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "esModuleInterop": true,
    "strict": true,
    "skipLibCheck": true,
    "outDir": "dist",
    "rootDir": "src"
  },
  "include": ["src/**/*"]
}

React + Vite frontend

{
  "compilerOptions": {
    "target": "ES2022",
    "lib": ["ES2022", "DOM", "DOM.Iterable"],
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "jsx": "react-jsx",
    "strict": true,
    "noEmit": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "isolatedModules": true,
    "allowImportingTsExtensions": true
  },
  "include": ["src"]
}

Library published to npm

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "declaration": true,
    "declarationMap": true,
    "sourceMap": true,
    "strict": true,
    "skipLibCheck": true,
    "outDir": "dist",
    "rootDir": "src"
  },
  "include": ["src/**/*"]
}

What the converter detects automatically

  • Module system — CommonJS require() vs ES Modules import, picks module: "NodeNext" or "ESNext" accordingly.
  • JSX — if any file uses JSX, sets jsx: "react-jsx".
  • Target — uses ES2022 by default; older targets only when async/await or top-level features are absent.
  • Strict mode — enabled by default; disable with the strict option in the converter UI for incremental migrations.
  • Output directorydist/ with rootDir: "src" when source layout is conventional.

Generate your tsconfig.json now

Upload a ZIP of your project — get TypeScript files plus a matching tsconfig.json back in seconds.