With Ionic 2 which is recommended ES6 ? or TypeScript?

I see lot of articles, tutorials for Ionic 2 with TypeScript; however, if i start a new Ionic 2 project, ES6 seems the default.
Which one is preferred? ES6 or TypeScript?

TypeScript. Ionic 2 source wrote in TypeScript.

+1 to TypeScript. Use private and public methods. Interfaces and other features helps to save a good project struct. And you must understand, that TypeScript is just next layout of es6, so you can use native es6 in your TS project too.
However, not all time you can found d.ts files of libraries, therefore you sometime need write it or you could use es6 syntax.
Have a nice choose )

1 Like

Currently JavaScript is the default for starters in Ionic 2 but this is going to change.

While I personally prefer TypeScript, there’s definitely a lot to be desired in terms of library support (e.g. there are still plenty of missing or outdated type definitions), especially for the less popular libraries (but not only). It’s also a matter of personal preference, so I would suggest you to learn more about TypeScript first and check some code written in it. There is a good article about TypeScript.

In the end the best way to decide is to probably make a small app in TypeScript (or find a tutorial for such an app in JavaScript and recreate it in TypeScript) so that you can feel the difference and decide on your own.

Also just adding my 2¢, when learning many new things, like ionic 2 and angular2, typescript can be pretty helpful.

The auto-completion and code hints in your editor are super useful and gives you a way to see what a method accepts as parameters.

Thanks so much all for the feedbacks. Seems I should go with TypeScript.
I got bit confused since the default was shown in ES6.

I’m pretty amazed with the result of Ionic 2. Love to upgrade my apps to v2.

1 Like

hopefully there will be a smart solution for missing typings (e.g. if you want to include a lib that is not typed, yet).

without adding an ugly “any” declaration. :wink:

A recent article on Medium about Why Typescript in Angular 2 :slight_smile: