In our most recent screencast, we talked about future-proofing your app. We converted our JavaScript to TypeScript and created a simple build step to compile everything back. Now, let’s look at how we can use TypeScript’s static types to annotate our code. We’ll add definition files for Ionic and start getting code completion in our editor.

Adding TSD

$ sudo npm install -g tsd
$ tsd install ionic cordova --save

Reference the definition files


/// <reference path="../typings/tsd.d.ts" />

Additional Notes

Follow up videos

Ionic and TypeScript Part 1

Ionic and TypeScript Part 3

Ionic and TypeScript Part 4

In my next post we’ll walk through converting our controllers to something more class like.

Sign up for the Ionic Newsletter to get the latest news and updates!