Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ImageData constructor #4306

Merged
merged 5 commits into from
Aug 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/dom.es6.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ interface NodeList {

interface NodeListOf<TNode extends Node> {
[Symbol.iterator](): IterableIterator<TNode>
}
}
9 changes: 6 additions & 3 deletions src/lib/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7016,11 +7016,14 @@ interface ImageData {
width: number;
}

declare var ImageData: {
interface ImageDataConstructor {
prototype: ImageData;
new(): ImageData;
new(width: number, height: number): ImageData;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think this is correct.. we need a new interface ImageDataConstructor so that:

// ImageData stayes the way it was

 interface ImageData {
     data: number[];
     height: number;
     width: number;
}

interface ImageDataConstructor {
    prototype: ImageData;
    new (): ImageData;
    new(width: number, height: number): ImageData;
}

declare var ImageData: ImageDataConstructor; 

new(array: Uint8ClampedArray, width: number, height: number): ImageData;
}

declare var ImageData: ImageDataConstructor;

interface KeyboardEvent extends UIEvent {
altKey: boolean;
char: string;
Expand Down Expand Up @@ -12958,4 +12961,4 @@ declare function addEventListener(type: "unload", listener: (ev: Event) => any,
declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void;
declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void;
declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void;
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
7 changes: 5 additions & 2 deletions src/lib/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,11 +465,14 @@ interface ImageData {
width: number;
}

declare var ImageData: {
interface ImageDataConstructor {
prototype: ImageData;
new(): ImageData;
new(width: number, height: number): ImageData;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is going to be a breaking change. are we sure that ImageData does not have a constructor overload that takes no arguments?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MDN spec has only two constructors with arguments. And I tried in IE, Edge, Firefox and Chrome, none of them supports an argument-less constructor for ImageData

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks 👍

new(array: Uint8ClampedArray, width: number, height: number): ImageData;
}

declare var ImageData: ImageDataConstructor;

interface MSApp {
clearTemporaryWebDataAsync(): MSAppAsyncOperation;
createBlobFromRandomAccessStream(type: string, seeker: any): Blob;
Expand Down