-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
microsoft/TypeScript-DOM-lib-generator
#790Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScript
Milestone
Description
TypeScript Version: 3.6.2
Search Terms:
ImageData
Code
const data: ImageData = new ImageData(screenBuffer, CANVAS_WIDTH);
Argument of type 'Uint8ClampedArray' is not assignable to parameter of type 'number'. TS2345
365 |
366 | }
> 367 | const data: ImageData = new ImageData(screenBuffer, CANVAS_WIDTH);
| also, simplified:
const screenBufferSize = 4;
const screenBuffer: Uint8ClampedArray = new Uint8ClampedArray(screenBufferSize);
const data: ImageData = new ImageData(screenBuffer, 1);Expected behavior:
MDN says that the height parameter is optional if the first parameter is a Uint8ClampedArray. Typescript should choose the new(array: Uint8ClampedArray, width: number, height: number): ImageData; overload, but the third param should be optional.
Actual behavior:
Typescript is choosing the new(width: number, height: number): ImageData; overload.
Playground Link:
Where's the share button?
Related Issues:
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScript