Closed
Description
Hello! I am a very huge fan of typescript, and I'm sure adding ImageBitmap
to the d.ts file responsible for canvas definitions should work.
Just to be clear, MDN lists the following things for CanvasRenderingContext2D.protortype.createPattern
A CanvasImageSource to be used as the image to repeat. It can be an:
- HTMLImageElement (<img>)
- HTMLVideoElement (<video>, by using the capture of the video)
- HTMLCanvasElement (<canvas>)
- CanvasRenderingContext2D
- ImageBitmap
- ImageData
- Blob
TypeScript Version: 2.9.2
Search Terms: Canvas. ImageBitmap, createPattern
Code
const image = await createImageBitmap(blob);
const pattern = ctx.createPattern(image);
Expected behavior:
Well I expect typescript to not report this as a problem.
Actual behavior:
Currently reported like this in my IDE.
Argument of type 'ImageBitmap' is not assignable to parameter of type 'HTMLCanvasElement | HTMLImageElement | HTMLVideoElement'.
Type 'ImageBitmap' is not assignable to type 'HTMLVideoElement'.
Property 'msHorizontalMirror' is missing in type 'ImageBitmap'.
Related Issues: There are a few issues that involve definitions, not sure where to put this.