Reputation: 5132
I'm trying to use easeljs with typescript
I've setup typescript, and installed typings by:
$ typings install easeljs --ambient
I have a file named canvas.ts
:
/// <reference path="browser/main.d.ts" />
var canv = < HTMLCanvasElement > document.createElement("canvas");
canv.width = 800;
canv.height = 600;
canv.style.border = "5px solid silver";
var stage = new createjs.Stage(canv);
var circle = new createjs.Shape();
circle.graphics.beginFill("DeepSkyBlue").drawCircle(0, 0, 50);
circle.x = 100;
circle.y = 100;
stage.addChild(circle);
stage.update();
document.body.appendChild(canv);
Calling tsc canvas.ts
I get:
typings/main/ambient/easeljs/easeljs.d.ts(187,40): error TS2304: Cannot find name 'EventDispatcher'.
typings/main/ambient/easeljs/easeljs.d.ts(657,19): error TS2304: Cannot find name 'Timeline'.
typings/main/ambient/easeljs/easeljs.d.ts(679,22): error TS2304: Cannot find name 'Tween'.
typings/main/ambient/easeljs/easeljs.d.ts(797,38): error TS2304: Cannot find name 'EventDispatcher'.
typings/main/ambient/easeljs/easeljs.d.ts(818,45): error TS2304: Cannot find name 'EventDispatcher'.
If I do typings install tweenjs --ambient
only the messages about EventDispatcher
remain. Installing createjs
using typings won't help.
After calling tsc
the .js file seems to be generated correctly (I can see the circle), but the error seems to indicate that I'm doing something wrong. Any ideas what it is?
Disclaimer: never used javascript/typescript before so it's probably something trivial.
Upvotes: 1
Views: 1458
Reputation: 275947
Typings doesn't install dependencies for ambient stuff by default as they can cause module dependency problems (e.g. the diamond problem).
However it does tell you which ones you might need:
You figured out tweenj.d.ts
. You also need createjs-lib
as pointed out 🌹
Upvotes: 4