diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index ef02a6a76..306b15f1a 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -13237,28 +13237,28 @@ interface Element extends Node, ARIAMixin, Animatable, ChildNode, NonDocumentTyp * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scroll) */ - scroll(options?: ScrollToOptions): Promise; - scroll(x: number, y: number): Promise; + scroll(options?: ScrollToOptions): void; + scroll(x: number, y: number): void; /** * The **`scrollBy()`** method of the Element interface scrolls an element by the given amount. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollBy) */ - scrollBy(options?: ScrollToOptions): Promise; - scrollBy(x: number, y: number): Promise; + scrollBy(options?: ScrollToOptions): void; + scrollBy(x: number, y: number): void; /** * The Element interface's **`scrollIntoView()`** method scrolls the element's ancestor containers such that the element on which scrollIntoView() is called is visible to the user. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollIntoView) */ - scrollIntoView(arg?: boolean | ScrollIntoViewOptions): Promise; + scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void; /** * The **`scrollTo()`** method of the Element interface scrolls to a particular set of coordinates inside a given element. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollTo) */ - scrollTo(options?: ScrollToOptions): Promise; - scrollTo(x: number, y: number): Promise; + scrollTo(options?: ScrollToOptions): void; + scrollTo(x: number, y: number): void; /** * The **`setAttribute()`** method of the Element interface sets the value of an attribute on the specified element. If the attribute already exists, the value is updated; otherwise a new attribute is added with the specified name and value. * @@ -39325,22 +39325,22 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scroll) */ - scroll(options?: ScrollToOptions): Promise; - scroll(x: number, y: number): Promise; + scroll(options?: ScrollToOptions): void; + scroll(x: number, y: number): void; /** * The **`Window.scrollBy()`** method scrolls the document in the window by the given amount. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scrollBy) */ - scrollBy(options?: ScrollToOptions): Promise; - scrollBy(x: number, y: number): Promise; + scrollBy(options?: ScrollToOptions): void; + scrollBy(x: number, y: number): void; /** * **`Window.scrollTo()`** scrolls to a particular set of coordinates in the document. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scrollTo) */ - scrollTo(options?: ScrollToOptions): Promise; - scrollTo(x: number, y: number): Promise; + scrollTo(options?: ScrollToOptions): void; + scrollTo(x: number, y: number): void; /** * The **`window.stop()`** stops further resource loading in the current browsing context, equivalent to the stop button in the browser. * @@ -41489,22 +41489,22 @@ declare function resizeTo(width: number, height: number): void; * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scroll) */ -declare function scroll(options?: ScrollToOptions): Promise; -declare function scroll(x: number, y: number): Promise; +declare function scroll(options?: ScrollToOptions): void; +declare function scroll(x: number, y: number): void; /** * The **`Window.scrollBy()`** method scrolls the document in the window by the given amount. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scrollBy) */ -declare function scrollBy(options?: ScrollToOptions): Promise; -declare function scrollBy(x: number, y: number): Promise; +declare function scrollBy(options?: ScrollToOptions): void; +declare function scrollBy(x: number, y: number): void; /** * **`Window.scrollTo()`** scrolls to a particular set of coordinates in the document. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scrollTo) */ -declare function scrollTo(options?: ScrollToOptions): Promise; -declare function scrollTo(x: number, y: number): Promise; +declare function scrollTo(options?: ScrollToOptions): void; +declare function scrollTo(x: number, y: number): void; /** * The **`window.stop()`** stops further resource loading in the current browsing context, equivalent to the stop button in the browser. * diff --git a/baselines/ts5.5/dom.generated.d.ts b/baselines/ts5.5/dom.generated.d.ts index 2c25f0954..8d3cc612d 100644 --- a/baselines/ts5.5/dom.generated.d.ts +++ b/baselines/ts5.5/dom.generated.d.ts @@ -13224,28 +13224,28 @@ interface Element extends Node, ARIAMixin, Animatable, ChildNode, NonDocumentTyp * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scroll) */ - scroll(options?: ScrollToOptions): Promise; - scroll(x: number, y: number): Promise; + scroll(options?: ScrollToOptions): void; + scroll(x: number, y: number): void; /** * The **`scrollBy()`** method of the Element interface scrolls an element by the given amount. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollBy) */ - scrollBy(options?: ScrollToOptions): Promise; - scrollBy(x: number, y: number): Promise; + scrollBy(options?: ScrollToOptions): void; + scrollBy(x: number, y: number): void; /** * The Element interface's **`scrollIntoView()`** method scrolls the element's ancestor containers such that the element on which scrollIntoView() is called is visible to the user. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollIntoView) */ - scrollIntoView(arg?: boolean | ScrollIntoViewOptions): Promise; + scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void; /** * The **`scrollTo()`** method of the Element interface scrolls to a particular set of coordinates inside a given element. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollTo) */ - scrollTo(options?: ScrollToOptions): Promise; - scrollTo(x: number, y: number): Promise; + scrollTo(options?: ScrollToOptions): void; + scrollTo(x: number, y: number): void; /** * The **`setAttribute()`** method of the Element interface sets the value of an attribute on the specified element. If the attribute already exists, the value is updated; otherwise a new attribute is added with the specified name and value. * @@ -39299,22 +39299,22 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scroll) */ - scroll(options?: ScrollToOptions): Promise; - scroll(x: number, y: number): Promise; + scroll(options?: ScrollToOptions): void; + scroll(x: number, y: number): void; /** * The **`Window.scrollBy()`** method scrolls the document in the window by the given amount. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scrollBy) */ - scrollBy(options?: ScrollToOptions): Promise; - scrollBy(x: number, y: number): Promise; + scrollBy(options?: ScrollToOptions): void; + scrollBy(x: number, y: number): void; /** * **`Window.scrollTo()`** scrolls to a particular set of coordinates in the document. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scrollTo) */ - scrollTo(options?: ScrollToOptions): Promise; - scrollTo(x: number, y: number): Promise; + scrollTo(options?: ScrollToOptions): void; + scrollTo(x: number, y: number): void; /** * The **`window.stop()`** stops further resource loading in the current browsing context, equivalent to the stop button in the browser. * @@ -41463,22 +41463,22 @@ declare function resizeTo(width: number, height: number): void; * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scroll) */ -declare function scroll(options?: ScrollToOptions): Promise; -declare function scroll(x: number, y: number): Promise; +declare function scroll(options?: ScrollToOptions): void; +declare function scroll(x: number, y: number): void; /** * The **`Window.scrollBy()`** method scrolls the document in the window by the given amount. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scrollBy) */ -declare function scrollBy(options?: ScrollToOptions): Promise; -declare function scrollBy(x: number, y: number): Promise; +declare function scrollBy(options?: ScrollToOptions): void; +declare function scrollBy(x: number, y: number): void; /** * **`Window.scrollTo()`** scrolls to a particular set of coordinates in the document. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scrollTo) */ -declare function scrollTo(options?: ScrollToOptions): Promise; -declare function scrollTo(x: number, y: number): Promise; +declare function scrollTo(options?: ScrollToOptions): void; +declare function scrollTo(x: number, y: number): void; /** * The **`window.stop()`** stops further resource loading in the current browsing context, equivalent to the stop button in the browser. * diff --git a/baselines/ts5.6/dom.generated.d.ts b/baselines/ts5.6/dom.generated.d.ts index 0103427c4..412c7b71a 100644 --- a/baselines/ts5.6/dom.generated.d.ts +++ b/baselines/ts5.6/dom.generated.d.ts @@ -13234,28 +13234,28 @@ interface Element extends Node, ARIAMixin, Animatable, ChildNode, NonDocumentTyp * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scroll) */ - scroll(options?: ScrollToOptions): Promise; - scroll(x: number, y: number): Promise; + scroll(options?: ScrollToOptions): void; + scroll(x: number, y: number): void; /** * The **`scrollBy()`** method of the Element interface scrolls an element by the given amount. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollBy) */ - scrollBy(options?: ScrollToOptions): Promise; - scrollBy(x: number, y: number): Promise; + scrollBy(options?: ScrollToOptions): void; + scrollBy(x: number, y: number): void; /** * The Element interface's **`scrollIntoView()`** method scrolls the element's ancestor containers such that the element on which scrollIntoView() is called is visible to the user. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollIntoView) */ - scrollIntoView(arg?: boolean | ScrollIntoViewOptions): Promise; + scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void; /** * The **`scrollTo()`** method of the Element interface scrolls to a particular set of coordinates inside a given element. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollTo) */ - scrollTo(options?: ScrollToOptions): Promise; - scrollTo(x: number, y: number): Promise; + scrollTo(options?: ScrollToOptions): void; + scrollTo(x: number, y: number): void; /** * The **`setAttribute()`** method of the Element interface sets the value of an attribute on the specified element. If the attribute already exists, the value is updated; otherwise a new attribute is added with the specified name and value. * @@ -39322,22 +39322,22 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scroll) */ - scroll(options?: ScrollToOptions): Promise; - scroll(x: number, y: number): Promise; + scroll(options?: ScrollToOptions): void; + scroll(x: number, y: number): void; /** * The **`Window.scrollBy()`** method scrolls the document in the window by the given amount. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scrollBy) */ - scrollBy(options?: ScrollToOptions): Promise; - scrollBy(x: number, y: number): Promise; + scrollBy(options?: ScrollToOptions): void; + scrollBy(x: number, y: number): void; /** * **`Window.scrollTo()`** scrolls to a particular set of coordinates in the document. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scrollTo) */ - scrollTo(options?: ScrollToOptions): Promise; - scrollTo(x: number, y: number): Promise; + scrollTo(options?: ScrollToOptions): void; + scrollTo(x: number, y: number): void; /** * The **`window.stop()`** stops further resource loading in the current browsing context, equivalent to the stop button in the browser. * @@ -41486,22 +41486,22 @@ declare function resizeTo(width: number, height: number): void; * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scroll) */ -declare function scroll(options?: ScrollToOptions): Promise; -declare function scroll(x: number, y: number): Promise; +declare function scroll(options?: ScrollToOptions): void; +declare function scroll(x: number, y: number): void; /** * The **`Window.scrollBy()`** method scrolls the document in the window by the given amount. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scrollBy) */ -declare function scrollBy(options?: ScrollToOptions): Promise; -declare function scrollBy(x: number, y: number): Promise; +declare function scrollBy(options?: ScrollToOptions): void; +declare function scrollBy(x: number, y: number): void; /** * **`Window.scrollTo()`** scrolls to a particular set of coordinates in the document. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scrollTo) */ -declare function scrollTo(options?: ScrollToOptions): Promise; -declare function scrollTo(x: number, y: number): Promise; +declare function scrollTo(options?: ScrollToOptions): void; +declare function scrollTo(x: number, y: number): void; /** * The **`window.stop()`** stops further resource loading in the current browsing context, equivalent to the stop button in the browser. * diff --git a/baselines/ts5.9/dom.generated.d.ts b/baselines/ts5.9/dom.generated.d.ts index 857e9bd69..a54dfb796 100644 --- a/baselines/ts5.9/dom.generated.d.ts +++ b/baselines/ts5.9/dom.generated.d.ts @@ -13234,28 +13234,28 @@ interface Element extends Node, ARIAMixin, Animatable, ChildNode, NonDocumentTyp * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scroll) */ - scroll(options?: ScrollToOptions): Promise; - scroll(x: number, y: number): Promise; + scroll(options?: ScrollToOptions): void; + scroll(x: number, y: number): void; /** * The **`scrollBy()`** method of the Element interface scrolls an element by the given amount. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollBy) */ - scrollBy(options?: ScrollToOptions): Promise; - scrollBy(x: number, y: number): Promise; + scrollBy(options?: ScrollToOptions): void; + scrollBy(x: number, y: number): void; /** * The Element interface's **`scrollIntoView()`** method scrolls the element's ancestor containers such that the element on which scrollIntoView() is called is visible to the user. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollIntoView) */ - scrollIntoView(arg?: boolean | ScrollIntoViewOptions): Promise; + scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void; /** * The **`scrollTo()`** method of the Element interface scrolls to a particular set of coordinates inside a given element. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollTo) */ - scrollTo(options?: ScrollToOptions): Promise; - scrollTo(x: number, y: number): Promise; + scrollTo(options?: ScrollToOptions): void; + scrollTo(x: number, y: number): void; /** * The **`setAttribute()`** method of the Element interface sets the value of an attribute on the specified element. If the attribute already exists, the value is updated; otherwise a new attribute is added with the specified name and value. * @@ -39322,22 +39322,22 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scroll) */ - scroll(options?: ScrollToOptions): Promise; - scroll(x: number, y: number): Promise; + scroll(options?: ScrollToOptions): void; + scroll(x: number, y: number): void; /** * The **`Window.scrollBy()`** method scrolls the document in the window by the given amount. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scrollBy) */ - scrollBy(options?: ScrollToOptions): Promise; - scrollBy(x: number, y: number): Promise; + scrollBy(options?: ScrollToOptions): void; + scrollBy(x: number, y: number): void; /** * **`Window.scrollTo()`** scrolls to a particular set of coordinates in the document. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scrollTo) */ - scrollTo(options?: ScrollToOptions): Promise; - scrollTo(x: number, y: number): Promise; + scrollTo(options?: ScrollToOptions): void; + scrollTo(x: number, y: number): void; /** * The **`window.stop()`** stops further resource loading in the current browsing context, equivalent to the stop button in the browser. * @@ -41486,22 +41486,22 @@ declare function resizeTo(width: number, height: number): void; * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scroll) */ -declare function scroll(options?: ScrollToOptions): Promise; -declare function scroll(x: number, y: number): Promise; +declare function scroll(options?: ScrollToOptions): void; +declare function scroll(x: number, y: number): void; /** * The **`Window.scrollBy()`** method scrolls the document in the window by the given amount. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scrollBy) */ -declare function scrollBy(options?: ScrollToOptions): Promise; -declare function scrollBy(x: number, y: number): Promise; +declare function scrollBy(options?: ScrollToOptions): void; +declare function scrollBy(x: number, y: number): void; /** * **`Window.scrollTo()`** scrolls to a particular set of coordinates in the document. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scrollTo) */ -declare function scrollTo(options?: ScrollToOptions): Promise; -declare function scrollTo(x: number, y: number): Promise; +declare function scrollTo(options?: ScrollToOptions): void; +declare function scrollTo(x: number, y: number): void; /** * The **`window.stop()`** stops further resource loading in the current browsing context, equivalent to the stop button in the browser. * diff --git a/inputfiles/patches/cssom-view.kdl b/inputfiles/patches/cssom-view.kdl index 58dc5121c..64c9b582c 100644 --- a/inputfiles/patches/cssom-view.kdl +++ b/inputfiles/patches/cssom-view.kdl @@ -14,3 +14,23 @@ interface-mixin DocumentOrShadowRoot { param y type=long } } + +// No implementation of Promise return values as of 2025-11 +interface Element { + method scroll returns=void signatureIndex=0 + method scroll returns=void signatureIndex=1 + method scrollBy returns=void signatureIndex=0 + method scrollBy returns=void signatureIndex=1 + method scrollTo returns=void signatureIndex=0 + method scrollTo returns=void signatureIndex=1 + method scrollIntoView returns=void signatureIndex=0 +} + +interface Window { + method scroll returns=void signatureIndex=0 + method scroll returns=void signatureIndex=1 + method scrollBy returns=void signatureIndex=0 + method scrollBy returns=void signatureIndex=1 + method scrollTo returns=void signatureIndex=0 + method scrollTo returns=void signatureIndex=1 +} diff --git a/src/build/patches.ts b/src/build/patches.ts index 48b18c179..6ba1f1b3e 100644 --- a/src/build/patches.ts +++ b/src/build/patches.ts @@ -9,6 +9,7 @@ import type { Typed, Dictionary, Member, + Signature, } from "./types.js"; import { readdir, readFile } from "fs/promises"; import { merge } from "./helpers.js"; @@ -17,6 +18,10 @@ type DeepPartial = T extends object ? { [K in keyof T]?: DeepPartial } : T; +interface OverridableMethod extends Omit { + signature: DeepPartial[] | Record>; +} + function optionalMember(prop: string, type: T, value?: Value) { if (value === undefined) { return {}; @@ -154,7 +159,7 @@ function handleMixinandInterfaces( const event: Event[] = []; const property: Record> = {}; - const method: Record> = {}; + let method: Record> = {}; for (const child of node.children) { switch (child.name) { @@ -168,7 +173,10 @@ function handleMixinandInterfaces( } case "method": { const methodName = string(child.values[0]); - method[methodName] = handleMethod(child); + const m = handleMethod(child); + method = merge(method, { + [methodName]: m, + }); break; } default: @@ -238,7 +246,7 @@ function handleProperty(child: Node): Partial { * Handles a child node of type "method" and adds it to the method object. * @param child The child node to handle. */ -function handleMethod(child: Node): Partial { +function handleMethod(child: Node): DeepPartial { const name = string(child.values[0]); let typeNode: Node | undefined; @@ -265,14 +273,24 @@ function handleMethod(child: Node): Partial { } } - const signature: Method["signature"] = [ - { - param: params, - ...(typeNode - ? handleTyped(typeNode) - : { type: string(child.properties?.returns) }), - }, - ]; + // Determine the actual signature object + const signatureObj: DeepPartial = { + param: params, + ...(typeNode + ? handleTyped(typeNode) + : { + type: string(child.properties?.returns), + subtype: undefined, + }), + }; + + let signature: OverridableMethod["signature"]; + const signatureIndex = child.properties?.signatureIndex; + if (typeof signatureIndex == "number") { + signature = { [signatureIndex]: signatureObj }; + } else { + signature = [signatureObj]; + } return { name, signature }; }