cjskywalker cjskywalker - 1 year ago 129
TypeScript Question

Should I use typescript? or I can just use ES6?

My daily job is client developer using AngularJS. We are evaluating if we want to go with TypeScript. I did some research on typescript and almost every JavaScript package I need must have definition type files. I found that is not very convenient, especially if I would like to try something new and they don't have the definition for it. Its really frustrating. (The current jQuery definition even give me some problem if I want to use typescript 1.5 beta). I started looking at ES6 and it looks similar to TypeScript. Should I just use ES6 instead? Also, I heard angular 2 will have full support for TypeScript, will that be one reason I should stay with it?

Answer Source

I've been using Typescript in my current angular project for about a year and a half and while there are a few issues with definitions every now and then the DefinitelyTyped project does an amazing job at keeping up with the latest versions of most popular libraries.

Having said that there is a definite learning curve when transition from vanilla JavaScript to TS and you should take into account the ability of you and your team to make that transition. Also if you are going to be using angular 1.x most of the examples you will find online will require you to translate them from JS to TS and overall there are not a lot of resources on using TS and angular 1.x together right now.

If you plan on using angular 2 there are a lot of examples using TS and I think the team will continue to provide most of the documentation in TS, but you certainly don't have to use TS to use angular 2.

ES6 does have some nice features and I personally plan on getting more familiar with it but I would not consider it a production ready language at this point. Mainly due to a lack of support by current browsers. See this SO answer for more details. Of course you can write you code and ES6 and use a transpiler to get it to ES5, which seems to be the popular thing to do right now.

Overall I think the answer would come down to what you and your team are comfortable learning. I personally think both TS and ES6 will have good support and long futures, I prefer TS though because you tend to get language features quicker and right now the tooling support(in my opinion) is a little better.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download