Coffeescript vs Typescript

With the arrival of Typescript 2.1, it seems like a good time for a comparison between coffee-script and typescript.

JavaScript is a powerful language, no question. One of the main issues however is code readability and that leads to difficult maintenance in the future. On teams this becomes and even larger issue as newer team members have to dig through JavaScript code wasting valuable development time just finding out what code does.

There’s now a number of different languages which compile down to JavaScript, however Coffeescript and Typescript seem to remain the two most popular. Other options to consider are: Babel, LiveScript, purescript, dart and opalrb.

Back to the point of this article, we’ve been using and loving Coffeescript for ages. It’s got a great minimalistic syntax that’s easy to learn. Most people already know Coffeescript (or can learn quickly thanks to the above). It’s no problem to convert the JavaScript back to source CoffeeScript.

There’s a few things we don’t love however, like when we accidentally create a duplicate variable from a higher scope. It can take a lot of time to track down these bugs, and they should be avoidable in a modern programming language.Sometimes the syntax can just be a little ambiguous as well.

We’ve spent more type looking at alternatives, but felt that Typescript was the way to go.

It will be great when Typescript has 100% parity with ES6, and add a few missing type system features such as bounded polymorphism and type bounds.

Why do we like Typescript so much? Built-in type annotations, and a lot of support for working with Angular2.

Comments