我正在尝试为 CreateJS ( www.createjs.com ) 制作一个 TypeScript 声明文件。
我有一个如下所示的基类声明:
/// <reference path="../geom/Point.d.ts"/>
/// <reference path="../geom/Rectangle.d.ts"/>
/// <reference path="../geom/Matrix2D.d.ts"/>
/// <reference path="../filters/Filter.d.ts"/>
/// <reference path="Shadow.d.ts"/>
/// <reference path="Shape.d.ts"/>
/// <reference path="Stage.d.ts"/>
declare module createjs {
class DisplayObject {
// constructor:
constructor();
... additional methods
}
}
然后我声明了更多从 DisplayObject 派生的类:
/// <reference path="DisplayObject.d.ts"/>
declare module createjs {
class Bitmap extends DisplayObject{
constructor (imageOrUri:any);
... additional methods
}
}
/// <reference path="DisplayObject.d.ts"/>
declare module createjs {
class Container extends DisplayObject{
constructor();
... additional methods
}
}
/// <reference path="../../tweenjs/Timeline.d.ts"/>
/// <reference path="DisplayObject.d.ts"/>
/// <reference path="Container.d.ts"/>
declare module createjs {
class MovieClip extends Container{
constructor (mode: string, startPosition: number, loop: bool, labels: any);
... additional methods
}
}
等等等等
但我总是遇到这样的编译器错误:
基类型“DisplayObject”在其声明之前被引用,或者基类型“Container”在其声明之前被引用。
我看不出我做错了什么,一切看起来都很好。任何帮助真的很感激......非常感谢提前!