I Love Me Some TypeScript

Thursday, March 5, 2015 3:10 PM

Blog post on typescript for publish on Thursday & Friday

This week my friend Dan Wahlin and I presented at [ng-conf](http://ng-conf.org on using TypeScript to create Angular apps. If you’re interested in seeing it watch the ng-conf YouTube channel as it will get posted soon. There was even some fantastic news that came out about TypeScript and Angular at the show - instead of proceeding with AtScript, the Angular team worked with the TypeScript team to extend the language and make it even better!

Not familiar with TypeScript? In a nutshell it is a superscript of JavaScript and enables you to use static types, interfaces, classes and lambda expressions in your JavaScript. This is compiled down to JavaScript and is thus transparent to the end users.

In our talk we explained why we both like TypeScript for JavaScript based development for varies reasons. For me, it really boils down to the following:

  • Catch coding issues faster - When you have static types, the compiler and IDEs can help you more, showing errors and possible issues before you have to run your app to find those errors.
  • Promotes good coding styles - One of the advantages of JavaScript is the ability to let you do things only dynamic languages let you do like adding fields on the fly and other things. Well sometimes you don’t want this… And this is where TypeScript can help… Create an interface or class with public properties that could be a specific type, any type and even be optional fields.
  • Get ready & familiar with ES6 today - This might be the biggest one for me. As you may be aware we are in the final stages of EcmaScript 6 being ratified. It’s a major change to get language… lots of goodness… like promises and classes to make just two things. Well you can’t do ES6 today because not all browsers support it. You could write it and transpile it down to ES5, or write TypeScript. Today TypeScript files compile down to ES5 but there’s a switch to compile it down to ES6. So use TypeScript to write your classes and interfaces and let the TypeScript compiler down to whatever one you need today or tomorrow. - It works in all JavaScript - When most hear JavaScript you think of client-side development. But there is a whole ecosystem I’m loving where you use JavaScript on the server using node.js or io.js or use it in your development tooling with task runners like gulp. I use it in all these places… and I find I’m much more productive with it.

So how do you get started? Check out the TypeScript site and search YouTube as well as Channel9 for videos… there are a ton of resources.

comments powered by Disqus