airbnb /ts-migrate
A tool to help migrate JavaScript code quickly and conveniently to TypeScript
★ 5,619⑂ 233👁 40⑃ 118● 105▤ 0
More from this author
+0
Daily
5,619
stars
233
forks
40
watchers
118
prs
105
issues
0
releases
README
ts-migrate
ts-migrate is a tool for helping migrate code to TypeScript.
It takes a JavaScript, or a partial TypeScript, project in and gives a compiling TypeScript project out.
ts-migrate is intended to accelerate the TypeScript migration process. The resulting code will pass the build, but a followup is required to improve type safety. There will be lots of // @ts-expect-error, and any that will need to be fixed over time. In general, it is a lot nicer than starting from scratch.
ts-migrate is designed as a set of plugins so that it can be pretty customizable for different use-cases. Potentially, more plugins can be added for addressing things like improvements of type quality or libraries-related things (like prop-types in React).
Plugins are combined into migration configs. We currently have two main migration configs:
for the main JavaScript → TypeScript migration
for the reignore script
These configs can be moved out of the default script, and people can add custom configs with a different set of plugins for their needs.
You can find instructions on how to install and run ts-migrate in the main package. If you find any issues or have ideas for improvements, we welcome your contributions!
Check out the blog post about ts-migrate!
Published Packages
| Folder | Version | Package |
| ------ | ------- | ------- |
| packages/ts-migrate | | ts-migrate |
| packages/ts-migrate-plugins | | ts-migrate-plugins |
| packages/ts-migrate-server | | ts-migrate-server |
Unpublished Packages
| Folder | Description |
| ------ | -----------|
| packages/ts-migrate-example | basic example of usage of the ts-migrate-server with a writing a custom simple plugin |
Authors
Brie Bunge
Sergii Rudenko
John Haytko
Elliot Sachs
Joe Lencioni
License
MIT, see LICENSE for details.Top issues
#150ts-migrate is inserting comments in JSX components18 comments · 2021-11-03#208Incorrect Transformation of Ternary Expressions Containing Function Calls15 comments · 2024-02-05#144Duplicating lines of code11 comments · 2021-09-29#168Modification Cornucopia9 comments · 2022-05-09#50Always prompt [ Must provide a command ], no matter how I call the command7 comments · 2020-09-28#103"bash is not recognized" Visual Studio Code6 comments · 2021-03-09#41Custom plugins6 comments · 2020-09-16#121Migrating explicit-any takes far longer than I expected5 comments · 2021-05-26