Skip to main content

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.
  1. Install dependencies:
 
  1. Configure TypeScript by creating a tsconfig.json in the root of your project (feel free to update these settings however you like):
 
  1. Configure ESLint to support both JS and TS files:
 
  1. When you’re ready to migrate a file, use git mv to rename it to .ts/.tsx:
 
  1. Address any type errors:
 
  1. Add any missing type annotations:
 

Inbox