Migrating an existing JavaScript codebase
A full-codebase rewrite to TypeScript is rarely the right move; TypeScript supports incremental adoption because it can type-check a mix of .ts and .js files in the same project. We typically start by enabling `allowJs` and `checkJs`, adding types to the modules with the most bugs or the most churn first, and letting the rest of the codebase convert opportunistically as files are touched for other reasons.
The modules worth converting first are usually the ones defining shared data shapes: API clients, core domain models, utility functions used everywhere. Converting those early gives the rest of the migration a typed foundation to build on, rather than typing UI components first and hitting untyped data flowing in from everywhere.










