From 87e38e6f38d76b6fabbea56b4f52b2597dfef71b Mon Sep 17 00:00:00 2001 From: lionel-rowe Date: Thu, 12 Dec 2024 16:51:38 +0800 Subject: [PATCH] Type Canvas.toBlob/toDataURL `quality` argument as `number` --- baselines/dom.generated.d.ts | 4 ++-- baselines/ts5.5/dom.generated.d.ts | 4 ++-- inputfiles/overridingTypes.jsonc | 35 ++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index 2f4c19f7a..bf67a90e1 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -10410,14 +10410,14 @@ interface HTMLCanvasElement extends HTMLElement { getContext(contextId: "webgl2", options?: WebGLContextAttributes): WebGL2RenderingContext | null; getContext(contextId: string, options?: any): RenderingContext | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/toBlob) */ - toBlob(callback: BlobCallback, type?: string, quality?: any): void; + toBlob(callback: BlobCallback, type?: string, quality?: number): 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; + toDataURL(type?: string, quality?: number): string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/transferControlToOffscreen) */ transferControlToOffscreen(): OffscreenCanvas; addEventListener(type: K, listener: (this: HTMLCanvasElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; diff --git a/baselines/ts5.5/dom.generated.d.ts b/baselines/ts5.5/dom.generated.d.ts index 410185806..eb68821e7 100644 --- a/baselines/ts5.5/dom.generated.d.ts +++ b/baselines/ts5.5/dom.generated.d.ts @@ -10398,14 +10398,14 @@ interface HTMLCanvasElement extends HTMLElement { getContext(contextId: "webgl2", options?: WebGLContextAttributes): WebGL2RenderingContext | null; getContext(contextId: string, options?: any): RenderingContext | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/toBlob) */ - toBlob(callback: BlobCallback, type?: string, quality?: any): void; + toBlob(callback: BlobCallback, type?: string, quality?: number): 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; + toDataURL(type?: string, quality?: number): string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/transferControlToOffscreen) */ transferControlToOffscreen(): OffscreenCanvas; addEventListener(type: K, listener: (this: HTMLCanvasElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; diff --git a/inputfiles/overridingTypes.jsonc b/inputfiles/overridingTypes.jsonc index e75948215..ced37ee6f 100644 --- a/inputfiles/overridingTypes.jsonc +++ b/inputfiles/overridingTypes.jsonc @@ -1330,6 +1330,41 @@ "getContext(contextId: \"webgl\", options?: WebGLContextAttributes): WebGLRenderingContext | null", "getContext(contextId: \"webgl2\", options?: WebGLContextAttributes): WebGL2RenderingContext | null" ] + }, + "toBlob": { + "name": "toBlob", + "signature": { + "0": { + "param": [ + { + "name": "callback" + }, + { + "name": "type", + }, + { + "name": "quality", + "overrideType": "number" + } + ], + } + } + }, + "toDataURL": { + "name": "toDataURL", + "signature": { + "0": { + "param": [ + { + "name": "type", + }, + { + "name": "quality", + "overrideType": "number" + } + ], + } + } } } }