ts-migrate is a codemod tool that automates the conversion of JavaScript projects to TypeScript.
The tool addresses the challenge of large-scale TypeScript migrations by automating the mechanical work of converting JavaScript or partially-typed TypeScript code into a compiling TypeScript project. Rather than requiring developers to manually rewrite code, ts-migrate applies a series of transformations that handle syntax conversion, type inference, and error suppression. The resulting code will compile but intentionally includes `// @ts-expect-error` annotations and `any` types as placeholders, acknowledging that the output is a starting point rather than a fully type-safe codebase. This approach trades initial type safety for speed, allowing teams to migrate large codebases quickly and then incrementally improve type quality afterward.
Teams should adopt ts-migrate when facing a substantial JavaScript codebase that needs TypeScript adoption but lack the resources for manual line-by-line conversion. The tool works best for projects where getting to a compiling state quickly matters more than immediate type perfection. The plugin-based architecture means the tool can be customized for different project structures and needs; the README describes two main migration configurations for general JavaScript-to-TypeScript conversion and for handling reignore scripts, with the ability to add custom plugins for domain-specific improvements like React prop-types handling.
The project maintains multiple published packages including the core ts-migrate tool, a plugins package, and a server component for interactive migration workflows. An example package demonstrates how to write custom plugins, indicating the maintainers have invested in making the extensibility model accessible to users.