TypeScript vs. JavaScript When Using Angular 2

Which one should you use?

Posted by Tomy Jaya on January 26, 2016

The Angular 2 Dilemma

When I decided to pick up Angular 2, I was faced with a dilemma of whether I should use TypeScript or JavaScript (note: Angular 2 supports 3 languages: JavaScript, TypeScript, and Google’s Dart).

TypeScript is a new language for me and having spent quite some with other JavaScript frameworks, I thought JavaScript will be a straightforward choice.

Nevertheless, you’d be surprised to know that after much deliberation, I chose TypeScript over JavaScript.

Why TypeScript?

Well, here are the reasons (in increasing significance):

  1. The framework itself “encourages” you to use TypeScript
  2. Both Google and Microsoft - 2 software Giants - are collaborating to develop this language
  3. TypeScript is a strict superset of JavaScript. This is the most important point. This means, in the event that the community favors Angular 2 with JavaScript and when in StackOverflow you see a proliferation of JavaScript answers to Angular 2 problems, you will fret not. You can easily copy paste the solutions verbatim and they will work seamlessly. And I’m afraid you can’t say otherwise.

Let me know of your thoughts below. In the meantime, while learning TypeScript, I should probably spawn a new Gist for my TypeScript notes (aka cheatsheet). That’s coming up! :)