Playbook · Migrations

Updated

How do you do a JavaScript to TypeScript migration without stopping work?

Do a JavaScript to TypeScript migration one file at a time. Turn on allowJs so TypeScript reads your existing files, rename one file to .ts, fix what it finds, and raise strictness step by step. The team keeps shipping the whole time.

TypeScript 7.0, the native compiler, makes strict mode the default and turns 6.0 deprecations into hard errors. Full builds of the VS Code codebase went from 125.7 seconds to 10.6 seconds.
Source: Microsoft TypeScript blog, 8 Jul 2026

From my work

On Itmatched we moved the backend from Node.js 10 to Node.js 16 and TypeScript, an Express REST API on Couchbase, and moved the front end to the latest Angular. It took about 6 months, with a new UI and a new architecture at the same time. There was no downtime because the product was not in production yet. Once the legacy code was fixed, the client started asking for gift cards, promotions and analytics pages. I pushed back: ship the MVP first, add the rest after launch. They agreed, and we went to production on time.

For one client I reviewed a codebase I rated 8 out of 10, with good separation of concerns, but all plain JavaScript. For a project that size, some types, or even just JSDoc, would have made it a 10.

Why teams move

Types catch the bugs that come from changing one file and forgetting the five that call it. On a small codebase you can live without them. On a big one, the code stays clean only as long as every developer is careful, and that never lasts.

Steps for a JavaScript to TypeScript migration

  • Add a tsconfig with allowJs and a separate outDir, so TypeScript reads .js files and never writes over your source.
  • Decide on stricter flags now, before you touch files. The handbook says it is easier to turn them on early.
  • Rename one .js file to .ts. It will find more errors than you hoped. Treat them like red squiggles in a document: the code still compiles.
  • Turn on noImplicitAny, then strictNullChecks, as the typed part grows. The second is the one that finds real bugs.
  • Files you can’t convert yet can still be checked: add // @ts-check and JSDoc types to a plain .js file.

What TypeScript 7 and Node change in 2026

  • TypeScript 7.0 (July 2026) has strict on by default. Microsoft recommends moving to 6.0 first, because 7.0 turns its deprecations into errors.
  • Node.js runs .ts files directly: type stripping is on by default since Node 22.18 and 23.6, and stable since 24.12 and 25.2. It only strips types and checks nothing, and it does not support enums or runtime namespaces. Keep tsc in CI.

What drives the effort

  • How dynamic the code is. Objects built up key by key and functions that return different shapes take the longest.
  • Libraries without types. You write the declarations yourself, or you type them as any and promise to come back.
  • How strict you want to end up. "Compiles with allowJs" and "strict everywhere" are very different budgets.

Read next

Sources

Start

Tell me where the product is stuck.

In 30 minutes we look at where things stand, what you need from a CTO right now, and which option fits. Either way, you leave with a clear next step.

How the call goes

  1. 01You tell me about the product, the team and the next 6 months.
  2. 02I ask about the code, the stack and what keeps breaking.
  3. 03We pick the option that fits, or agree that none does.

09:00 to 20:00 CET

Founding rate: the first 3 clients get 20% off, in return for a named testimonial and a case study. On a monthly plan, the 20% applies to the first month.