Skip to content

Optional quality argument of HTMLCanvasElement#toBlob and HTMLCanvasElement#toDataURL wrongly typed any (should be number) #1861

@lionel-rowe

Description

@lionel-rowe

The optional quality argument of HTMLCanvasElement#toBlob and HTMLCanvasElement#toDataURL wrongly typed any (should be number).

https://github.com/microsoft/TypeScript-DOM-lib-generator/blob/ec4a1fbc057ba70fb6ef8107faf482e7e94b86eb/baselines/dom.generated.d.ts#L10412-L10420

    /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/toBlob) */
    toBlob(callback: BlobCallback, type?: string, quality?: any): void;
    /**
     * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element.
     * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
     *
     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/toDataURL)
     */
    toDataURL(type?: string, quality?: any): string;

https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob#quality
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL#encoderoptions

A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions