Skip to content
RED SAGSkills
hardFrontend Developer interview question

You join a team with a large JavaScript React codebase. How would you migrate it to TypeScript without stopping feature work?

What the interviewer wants to hear

  • Incremental migration with allowJs and checkJs, converting file by file
  • Start from leaves and shared utilities, then types for API models
  • Tighten strictness gradually and track progress, for example with a count of any or ts-expect-error
  • Keep CI green: type checks in the pipeline, no big-bang rewrite branch
  • Agree on conventions, give training and make new files TypeScript by default

Model answer

I would never do a big-bang rewrite. First I add TypeScript with allowJs so .js and .ts files live together, wire tsc --noEmit into CI, and agree on one rule: new files are written in TypeScript. Then I convert from the leaves up: shared utilities, hooks and design system components first, because many files depend on them and their types spread value quickly. Early on I define types for API models, ideally generated from an OpenAPI schema or validated with Zod, since data shapes cause many real bugs. I start with a loose config and tighten it over time, enabling strict and noImplicitAny per folder or using ts-expect-error comments as a visible to-do list, and I track the number of remaining any and JavaScript files on a dashboard. Teams convert files when they touch them for features, so migration rides along with normal work. Codemods help with mechanical changes, and short pairing sessions spread good patterns.

Can you answer it under time pressure?

Take a timed hard round and get scored on every answer.

Start mock interview

More hard Frontend Developer questions