Migrating to TypeScript Fast

TypeScript is an open-source programming language that was developed by Microsoft. It’s a superset of JavaScript — it can do everything that JavaScript can do but also adds extra features.

Benefits of using TypeScript:

  • It’s been around for awhile so it has a strong community and a ton of online resources.
  • TypeScript can speed up your development process with optional static typing. You’ll see your errors while you are typing instead of at runtime.
  • It can make your code more readable to other team members. Making it easier to onboard someone quickly to your codebase.

Here’s the quick and easy way to migrate to TypeScript.

  1. Create a tsconfig.json file to your project. This will tell your project which files to include/exclude. In a nutshell, it’s just your compiler options.


“compilerOptions”: {
“module”: “system”,
“target”: “es5”,
“noImplicitAny”: true,
“removeComments”: true,
“preserveConstEnums”: true,
“sourceMap”: true

Note: this is only an example. You’ll need to create your own tsconfig.json for your project.

Check out the documentation for all your compiler options here.

2. Next, you’ll need to rename your .js files to .ts.

3. Convert your imports/exports to ES6 style.

4. Check for any errors once you’ve compiled your new .ts files. If you use VS code, you’ll be able to see your errors while you’re writing your code. Here’s a great resource for that here.

5. Finally, run your tests again to make sure they’re still passing.

If you want to learn more about TypeScript, check out this awesome free book.

Sign up for my newsletter here.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store