๐Ÿ“ฆ airbnb / ts-migrate

A tool to help migrate JavaScript code quickly and conveniently to TypeScript

โ˜… 5.6k stars โ‘‚ 228 forks ๐Ÿ‘ 5.6k watching โš–๏ธ MIT License
codemodjavascriptmigrationtypescript
๐Ÿ“ฅ Clone https://github.com/airbnb/ts-migrate.git
HTTPS git clone https://github.com/airbnb/ts-migrate.git
SSH git clone git@github.com:airbnb/ts-migrate.git
CLI gh repo clone airbnb/ts-migrate
Sergii Rudenko Sergii Rudenko Merge pull request #210 from airbnb/dependabot/npm_and_yarn/json5-2.2.3 d714181 1 years ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ .vscode
๐Ÿ“ packages
๐Ÿ“„ .eslintignore
๐Ÿ“„ .eslintrc.js
๐Ÿ“„ .gitattributes
๐Ÿ“„ .gitignore
๐Ÿ“„ CONTRIBUTING.md
๐Ÿ“„ lerna.json
๐Ÿ“„ LICENCE
๐Ÿ“„ package.json
๐Ÿ“„ README.md
๐Ÿ“„ tsconfig.base.json
๐Ÿ“„ yarn.lock
๐Ÿ“„ README.md

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

FolderVersionPackage
packages/ts-migratenpm versionts-migrate
packages/ts-migrate-pluginsnpm versionts-migrate-plugins
packages/ts-migrate-servernpm versionts-migrate-server

Unpublished Packages

FolderDescription
packages/ts-migrate-examplebasic 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.