When to use TypeScript — an exhaustive example

Dan Nolan
1 min readApr 8, 2019

--

Lots of articles and twitter threads have popped up over this, so I thought I’d offer a definitive point on when you should use TypeScript versus when you should use vanilla Javascript for programs if you’re able to choose either stack.

Definitively — When should you use Typescript?

  • Whenever you’re writing code you’ll have to maintain or use more than once

There’s no reason to use vanilla Javascript on anything other than basic scripts or throwaway work, if you have an existing ES6 or Node project, you should be looking to migrate over. It takes less than two minutes to set up a TS pipeline on a new project and less than a day to get it working on a bigger project (give or take). Do your future self a favour.

--

--