Files
coffeescript/documentation/sections/coffeescript_2.md
Geoffrey Booth d1d2c16fdd Update docs for classes, breaking changes (#4438)
* Update classes docs for CS2

* Port breaking changes from https://github.com/jashkenas/coffeescript/wiki/%5BWIP%5D-Breaking-changes-in-CoffeeScript-2 into new docs section

* Update browser compiler

* Update re @connec’s notes; split classes section into two sections for classes and working with prototypes; make breaking changes examples editable whenever possible
2017-02-09 08:50:11 -08:00

1.2 KiB
Raw Blame History

CoffeeScript 2

CoffeeScript 2 generates JavaScript that uses the latest ES2015+ features. It is your responsibility to ensure that your target JavaScript runtime(s) support all these features, or that you pass the output through another transpiler like Babel, Rollup or Traceur Compiler. In general, CoffeeScript 2s output is fully supported by Node.js 7+, although async functions require the --harmony or --harmony-async-await flags; and ES2015 modules require an additional transpiler. Output JavaScript intended for browsers generally requires additional transpilation.

If youre looking for a single tool that takes CoffeeScript input and generates JavaScript output that runs in any JavaScript runtime, assuming you opt out of certain newer features, stick to the CoffeeScript 1.x branch. CoffeeScript 2 breaks compatibility with certain CoffeeScript 1.x features in order to conform with the ES2015+ specifications, and generate more idiomatic output (a CoffeeScript => becomes an ES =>; a CoffeeScript class becomes an ES class; and so on).