From a8279917cd269caa3595faf778ec0f6ed9ba7fbf Mon Sep 17 00:00:00 2001 From: Pedro Ferreira Date: Sat, 3 Nov 2012 04:45:16 +0000 Subject: [PATCH 1/2] fix wrong type Image (into HTMLImageElement) / make Container.addChildAt() not give warning --- Definitions/easeljs-0.5.d.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Definitions/easeljs-0.5.d.ts b/Definitions/easeljs-0.5.d.ts index 974faa11c7..ee78cec695 100644 --- a/Definitions/easeljs-0.5.d.ts +++ b/Definitions/easeljs-0.5.d.ts @@ -93,7 +93,7 @@ module createjs { alphaMap: any; //Image or HTMLCanvasElement // methods - constructor (alphaMap: Image); //HERE doesn't recognize Image type + constructor (alphaMap: HTMLImageElement); constructor (alphaMap: HTMLCanvasElement); clone(): AlphaMapFilter; } @@ -101,10 +101,10 @@ module createjs { export class AlphaMaskFilter extends Filter { // properties - mask: Image; //HERE or HTMLCanvasElement + mask: any; //HERE or HTMLCanvasElement // methods - constructor (mask: Image); + constructor (mask: HTMLImageElement); constructor (mask: HTMLCanvasElement); clone(): AlphaMaskFilter; } @@ -117,7 +117,7 @@ module createjs { sourceRect: Rectangle; // methods - constructor (imageOrUrl: Image); + constructor (imageOrUrl: HTMLImageElement); constructor (imageOrUrl: HTMLCanvasElement); constructor (imageOrUrl: HTMLVideoElement); constructor (imageOrUrl: string); @@ -223,7 +223,8 @@ module createjs { // methods addChild(...child: DisplayObject[]): DisplayObject; - addChildAt(...child: DisplayObject[], index: number): DisplayObject; //HERE typescript doesnt like having an argument after the variable length argument + //addChildAt(...child: DisplayObject[], index: number): DisplayObject; //HERE typescript doesnt like having an argument after the variable length argument + addChildAt(...child: any[]): DisplayObject; clone(recursive?: bool): Container; contains(child: DisplayObject): bool; getChildAt(index: number): DisplayObject; @@ -482,9 +483,9 @@ module createjs { export class SpriteSheetUtils { static addFlippedFrames(spriteSheet: SpriteSheet, horizontal?: bool, vertical?: bool, both?: bool): void; - static extractFrame(spriteSheet: Image, frame: number): Image; //HERE - static flip(spriteSheet: Image, flipData: Object): void; - static mergeAlpha(rgbImage: Image, alphaImage: Image, canvas?: HTMLCanvasElement): HTMLCanvasElement; + static extractFrame(spriteSheet: HTMLImageElement, frame: number): HTMLImageElement; + static flip(spriteSheet: HTMLImageElement, flipData: Object): void; + static mergeAlpha(rgbImage: HTMLImageElement, alphaImage: HTMLImageElement, canvas?: HTMLCanvasElement): HTMLCanvasElement; } From 14389e137e73d483211edb78ab0fe1042100cfd9 Mon Sep 17 00:00:00 2001 From: Pedro Ferreira Date: Sat, 3 Nov 2012 04:52:49 +0000 Subject: [PATCH 2/2] change return type do any of methods/properties that can return more than 1 type --- Definitions/easeljs-0.5.d.ts | 6 +++--- Definitions/soundjs-0.3.d.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Definitions/easeljs-0.5.d.ts b/Definitions/easeljs-0.5.d.ts index ee78cec695..a3452a7199 100644 --- a/Definitions/easeljs-0.5.d.ts +++ b/Definitions/easeljs-0.5.d.ts @@ -101,7 +101,7 @@ module createjs { export class AlphaMaskFilter extends Filter { // properties - mask: any; //HERE or HTMLCanvasElement + mask: any; // HTMLImageElement or HTMLCanvasElement // methods constructor (mask: HTMLImageElement); @@ -112,7 +112,7 @@ module createjs { export class Bitmap extends DisplayObject { // properties - image: any; //HERE how to tell the various type possibilities? + image: any; // HTMLImageElement or HTMLCanvasElement or HTMLVideoElement snapToPixel: bool; sourceRect: Rectangle; @@ -471,7 +471,7 @@ module createjs { spriteSheet: SpriteSheet; // methods - addFrame(source: DisplayObject, sourceRect?: Rectangle, scale?: number, setupFunction?: () => any, setupParams?: any[], setupScope?: Object): number; //HERE returns number or null + addFrame(source: DisplayObject, sourceRect?: Rectangle, scale?: number, setupFunction?: () => any, setupParams?: any[], setupScope?: Object): any; //HERE returns number or null addMovieClip(source: MovieClip, sourceRect?: Rectangle, scale?: number): void; build(): void; buildAsync(callback?: (reference: SpriteSheetBuilder) => any, timeSlice?: number): void; diff --git a/Definitions/soundjs-0.3.d.ts b/Definitions/soundjs-0.3.d.ts index e9f5c425e8..7355b34b7c 100644 --- a/Definitions/soundjs-0.3.d.ts +++ b/Definitions/soundjs-0.3.d.ts @@ -45,7 +45,7 @@ module createjs { paused: bool; playState: string; src: string; - uniqueId: string; //HERE string or number + uniqueId: any; //HERE string or number // methods getDuration(): number; @@ -89,7 +89,7 @@ module createjs { // methods static checkPlugin(initializeDefault: bool): bool; static getCapabilities(): Object; - static getCapability(key: string); //HERE can return string | number | bool + static getCapability(key: string): any; //HERE can return string | number | bool static getInstanceById(uniqueId: string): SoundInstance; static getMasterVolume(): number; static getSrcFromId(value: string): string;