Gradually migrating a JavaScript project to TypeScript
- You want to convert your project to TypeScript but you don’t have time right now to convert every single file
- Update your
tsconfig.json
and eslintrc.js
to allow you to migrate individuals files whenever you have time.
- Install dependencies:
- Configure TypeScript by creating a
tsconfig.json
in the root of your project (feel free to update these settings however you like):
- Configure ESLint to support both JS and TS files:
- When you’re ready to migrate a file, use
git mv
to rename it to .ts/.tsx
:
- Address any type errors:
- Add any missing type annotations:
Inbox