Skip to content
CodeMorph
Learn

tsconfig.json explained for migrations

The compiler options that matter when you move a JavaScript project to TypeScript, what each one does, and sensible settings for each stage.

Beginner3 min readUpdated 11 October 2026

tsconfig.json controls how TypeScript reads and checks your project. During a migration, a handful of options matter far more than the rest. Here's what they do and how to set them at each stage.

The options that matter

OptionWhat it doesDuring migration
allowJsLets .js files be part of the programtrue until the last file is converted
checkJsType-checks .js files toofalse while migrating; use --checkJs on the command line to measure
strictTurns on the full set of strict checksfalse at first, then on, one flag at a time
noEmitType-check only, don't write outputtrue if a bundler or runtime compiles your code
moduleWhich module system to emitNodeNext for Node; ESNext with a bundler
moduleResolutionHow imports are foundNodeNext for Node; Bundler with a bundler
targetWhich JavaScript version to emitMatch your runtime, e.g. ES2022
esModuleInteropSmooths default imports from CommonJS packagestrue
resolveJsonModuleAllows importing .json filestrue if you import JSON
skipLibCheckSkips checking .d.ts files in dependenciestrue, for speed and fewer third-party errors
baseUrl / pathsImport aliases such as @/utilsCopy from your bundler or jsconfig
includeWhich files belong to the projectUsually ["src"]

Stage 1: starting out

Accept JavaScript, check nothing strictly, and change no output:

tsconfig.json
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "allowJs": true,
    "checkJs": false,
    "strict": false,
    "noEmit": true,
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "skipLibCheck": true
  },
  "include": ["src"]
}

Measure your baseline without changing the file:

npx tsc --noEmit --checkJs

Stage 2: migrating

Keep the config the same while files convert. Each converted .ts file is checked with the rules above, and the remaining .js files are allowed but not checked.

If you already have a jsconfig.json with paths, move those options into tsconfig.json and delete the jsconfig, so editor tooling and the compiler agree.

Stage 3: finishing

When no JavaScript is left:

{
  "compilerOptions": {
    "allowJs": false,
    "strict": true
  }
}

Turn on strict gradually if the error count is high. See Turning on strict mode.

Bundlers and frameworks

If Vite, Next.js, webpack or another tool compiles your code, tsc should only check:

{
  "compilerOptions": {
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "noEmit": true,
    "jsx": "react-jsx"
  }
}

Frameworks often generate a starting config for you. Next.js, for example, writes one the first time it sees a .ts file. Keep its settings and add the migration options above.

Useful extras

  • "noUncheckedIndexedAccess": true makes array[i] possibly undefined, catching a common class of bugs. Turn it on after strict.
  • "verbatimModuleSyntax": true makes type-only imports explicit, which helps tools that compile files one at a time.
  • "incremental": true speeds up repeated checks by caching results.

How CodeMorph uses your tsconfig

CodeMorph reads paths and baseUrl to resolve imports during Scan & Plan, and Run & Verify type-checks against your tsconfig.json, so your strictness is the bar every converted file has to meet.

Next guideTypes for third-party packages

Let CodeMorph do the heavy lifting.

Download the beta, open a project and see your migration plan in under a minute.