TypeScript Definitions (d.ts)?

Topics: General, Language Specification
Oct 12, 2013 at 10:07 AM
Hey I've just started developing a HTML5 game using WebStorm and I want to use TypeScript as my JavaScript preprocessor.

I've got it all setup so that my TypeScript files have Watchers on them so they'll compile the JavaScript files everytime I save the file (and there are no syntax errors).

However I want to use the EaselJS from the CreateJS library.

How do I go about using this existing JavaScript library through TypeScript in WebStorm?

I read somewhere you need to use TypeScript definition files, I found the one for EaselJS here.

How do I go about using it in my WebStorm project?

Thanks in advance,
Coordinator
Oct 14, 2013 at 6:21 PM
You can reference .d.ts files from TypeScript using this form at the top of your file:

///<reference path="easeljs.d.ts"/>

Another good resource is reading through the TypeScript samples that you can get to in the TypeScript source (or via the TypeScript website). These show off a lot of good TypeScript patterns to get you going.