Image result for typescript logo

TypeScript — Because I don’t have time for JavaScript

TypeScript is Microsoft’s silencer to all the colorful language you hear coming from the JavaScript developer community! The static-typing and language services make it a logical choice for those who aren’t afraid to rely on an IDE. Unless you’re comfortable slinging vanilla JS in a non-intelligent text editor, TypeScript might be something you should consider.

I have been quoted saying:

TypeScript makes JavaScript tolerable!

I recently tweeted about a simple scenario I was investigating and was called a “fanboy” by my friend Chris DeMars.

Yes, I am absolutely a “fanboy” because I do not have time to sling JavaScript. It is quite simply a matter of productivity.

TypeScript literally enables me to write a shit-ton of code that will not fail because of a typo or because I passed an incorrect argument to an unknown API….no.

TypeScript’s language services will come to the proverbial rescue. I can rest assured that if my TypeScript code successfully transpiles, that these errors cannot possibly exist. Instead I’m left to tend to the matter of actual development where I care more about implementation details, design-patterns and best practices. I can leverage Visual Studio Code to write reliable, robust and even object-oriented code.

There is an online TypeScript playground. I literally use this at least once daily. It allows you to test out your TypeScript and on the right, you get to see the transpiled JavaScript. One glance at this below and it is pretty obvious. How much longer would it have taken to write the code on the right? What support would the IDE have given you? Which one reads better to the next developer, left or right — you decide?

I was curious how difficult it would be to define an interface, then create a class that implements this interface. Finally, I would have a sub-class of the implementation that extends it. This was in fact extremely simple; however, to do this in JavaScript — not so much.

If you’re not using TypeScript today, perhaps it is time to cave in and give it a go?! Take it from me, one of countless “fanboy’s”. TypeScript can literally do so much more than this, checkout another post I wrote on TypeScript here.