42

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

8
  • 2
    It's entirely up to you, a matter of personal opinion, and therefore off-topic for SO. Commented Feb 1, 2016 at 11:24
  • Note that you can easily transpile the TypeScript tutorials and examples into JavaScript with the TypeScript compiler (or even just the website. I expect the same is true of Dart, as it also "compiles" to JavaScript, but I don't now how readable it would be, never used the Dart compiler, don't know if it has any "pretty" options. Commented Feb 1, 2016 at 11:25
  • 1
    @T.J.Crowder I know it is going to be off-topic. But I don't know which stack exchange would be more appropriate to this question. Also, stackoverflow has the biggest developer community and I believe it is a valid question to ask. Commented Feb 1, 2016 at 11:26
  • 2
    @Elfayer — If you know it is off-topic then you should know that it isn't a valid question to ask here, and what you know should trump what you believe. Commented Feb 1, 2016 at 11:40
  • 1
    @Quentin Maybe you didn't notice, but there is a lot of opinion based question in stackoverflow that are community wiki. Or else, where to ask them ? Commented Feb 1, 2016 at 12:38

1 Answer 1

31

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.

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks a lot for your answer. I didn't know that "TS is used to develop Angular2 itself" and that using Javascript requires "workarouds". I'll definetly try to go for TypeScript then. ;)
Well now angular2 Dart project is a separate project and not a conversation from the typescript version
I don't think this makes any difference. We'll see how it turns out.
People are looking at this. Dart ecosystem is in constant flux and has way less support than TypeScript does. People are choosing TS. Consider expanding your answer.
No idea what you mean. Dart is a great language and platform to use Angular2 with. Just because more choose TS than Dart doesn't mean its superior in every way.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.