Should you use Typescript for your next project?

Monday, October 5, 2015

TLDR; yes.

As a C# developer, I instantly loved Typescript for its features that make object oriented programming easy. I also love that it supports a lambda syntax for functional programming (which will actually be vanilla Javascript in ECMAScript 6.) But after developing in it for a few months now I thought it was also worth pointing out the other reasons I think it’s worth trying for your next project.

Firstly, it is easy to get started and low commitment.

  • Your existing Javascript files are valid Typescript. Just change the extension from .js to .ts and you can start using them in your Typescript project.
  • There’s no commitment to stick to it. Typescript compiles to sensible, well structured, readable Javascript. So if you want to go back to using vanilla Javascript, you can just take the compiled files and go from there.

Then there are the pragmatic things that will make developing that bit easier.

  • Compile time errors. Fewer bugs make it to run time, and errors are quick and easy to spot, especially if your compiler is paired with an IDE that has good Typescript intellisense, like Webstorm.
  • Better intellisense. Interfaces and class definitions mean your IDE can suggest/autofill available properties and methods. C# devs used to Visual Studio and ReSharper will be well acquainted with how much time this saves.
  • Code readability. Whether your own old code, or someone else’s, it’s way easier to work out what’s going on when you have explicit typing.

What are other people’s main impressions of moving from Javascript to Typescript?

One comment on “Should you use Typescript for your next project?”

Leave a Reply

Your email address will not be published. Required fields are marked *