With AngularJS 2 coming out, the documentation is suggesting three languages :
Typescript
, Javascript
and Dart
.
I'm only used to Javascript EcmaScript 5 and am wondering what are the strength and weakness of these three ?
At the time this question is asked, the documentation is more developed on Typescript and pretty slim on the others (even their own language Dart):
- Typescript: 4 Tutorials, 16 Developer Guides, 4 Testing Guides
- Javascript: 0 Tutorials, 4 Developer Guides, 0 Testing Guides
- Dart: 0 Tutorials, 14 Developer Guides, 0 Testing guides
Should I change my habit of developing using Javascript and follow what Angular 2 is suggesting by using Typescript ? Does it really change the concepts of Javascript ?
AngularJS 2.0 official website
Dart makes it easy to start because everything you need is provided by the Darts ecosystem out of one hand (language, package management, build, ...).
TypeScript
For TS there are the most resources available (documentation, ...) because there is a huge user base.
The Dart and JS version of Angular is generated from TS.
There seem to be lots of issues to get a Angular+TS project up and running (see Angular2 questions here on SO) but there are seed projects available where everything is set up already. I don't know details because I'm using only Dart myself.
For TS there is now Angular CLI which improves the developer experience a lot for Angular2 with TypeScript.
JavaScript, ES5, ES6
If you're a JS purist, it might be the right language for you. If not (if you were you probably wouldn't ask this question) then I'm quite sure you're better off using Dart or TS.
Angular makes use of type annotations in several ways. With JS there are "workarounds" needed, where otherwise a simple type annotation is enough (mostly dependency injection).
Dart
Dart is a nice language with a set of tools that work well together.
A lot of issues the JS/TS environment causes are solved elegantly for Dart.
Since about 2016/05 Angular2 Dart is an independent project and differs quite a lot from the TS and JS versions (as of 2016/10).
The Router module that was replaced in TS several times to make it work with offline template compilation, wasn't replaced in Dart because in Dart lazy loading also works fine with the "old" router.
... and also NgModule
wasn't introduced to Dart for the same reason.
The new Forms module built for TS wasn't ported (yet) to Dart.
Dart had offline template compilation from the beginning but doesn't support the browser-platform-dynamic to compile components at runtime.
A new Dependency Injection module seems to be work in progress for Dart based on Dagger2 (currently not yet available) to replace the DI system that was auto-generated from TypeScript code.
Angular2 Dart has a strong focus on build output size and runtime performance but AFAIK support for multi-platform support (like server-side rendering) was dropped.