Transpiler Tradeoffs: TypeScript, CoffeeScript, ES6

ES6 JavaScript will give you most of what TypeScript and CoffeeScript give you, without all the transpiling. *

Quincy Larson originally posted on Quora by Quincy Larson

* ES6 will soon be standard in every browser, so you won’t need Babel to transpile it any more.

TypeScript

  • is a superset of JavaScript – all JavaScript programs will run in TypeScript
  • will perform compile-time type checking, and give you more and better error messages than ES6 would
  • will feel more comfortable if you’re used to coding in Java or C#

CoffeeScript

  • Is whitespace-sensitive, which forces you to use better spacing
  • Makes much JavaScript syntax optional (which makes code easier to read, but can lead to ambiguity)
  • will feel more comfortable if you’re used to coding in Ruby or Python

So, basically: TypeScript catches bugs and CoffeeScript makes reading code less painful.

Here’s why most people should probably just stick with ES6 JavaScript:

  • It’s always “edge”. TypeScript and CoffeeScript will forever trail ES6 JavaScript in terms of features, because all of these will need to be ported over.
  • Everyone has to learn how to read and write ES6 JavaScript anyway, because when you debug in the browser, that’s what you’ll be reading.
  • The ES6 JavaScript community will be much bigger than CoffeeScript’s community or TypeScript’s community (even after TypeScript is included in Angular 2.0) – this means a lot better documentation and more widely available tutorials.

For example, Free Code Camp‘s curriculum already teaches ES6, and you’d be hard pressed to find anything as end-to-end that teaches CoffeeScript or TypeScript this comprehensively.

Use whichever you’re comfortable with, but do take the time to learn ES6 JavaScript.

Read more about the features of TypeScript, CoffeeScript and ES6 in this excellent presentation: TypeScript vs. CoffeeScript vs. ES6

Comments