From 7412e2ae750202bba1131798610d0aa7965e7cc9 Mon Sep 17 00:00:00 2001 From: Bashamega Date: Wed, 31 Dec 2025 07:36:03 +0200 Subject: [PATCH 1/2] Create a Globalized Type --- baselines/dom.generated.d.ts | 11 ++++++----- baselines/serviceworker.generated.d.ts | 5 +++-- baselines/sharedworker.generated.d.ts | 5 +++-- baselines/ts5.5/dom.generated.d.ts | 11 ++++++----- baselines/ts5.5/serviceworker.generated.d.ts | 5 +++-- baselines/ts5.5/sharedworker.generated.d.ts | 5 +++-- baselines/ts5.5/webworker.generated.d.ts | 5 +++-- baselines/ts5.6/dom.generated.d.ts | 11 ++++++----- baselines/ts5.6/serviceworker.generated.d.ts | 5 +++-- baselines/ts5.6/sharedworker.generated.d.ts | 5 +++-- baselines/ts5.6/webworker.generated.d.ts | 5 +++-- baselines/ts5.9/dom.generated.d.ts | 11 ++++++----- baselines/ts5.9/serviceworker.generated.d.ts | 5 +++-- baselines/ts5.9/sharedworker.generated.d.ts | 5 +++-- baselines/ts5.9/webworker.generated.d.ts | 5 +++-- baselines/webworker.generated.d.ts | 5 +++-- inputfiles/overridingTypes.jsonc | 17 ----------------- inputfiles/patches/dom.kdl | 8 ++++++++ inputfiles/patches/html.kdl | 17 +++++++++++++++++ src/build/patches.ts | 18 +++++++++++++++++- 20 files changed, 102 insertions(+), 62 deletions(-) diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index 0df481561..ddc7f8e6e 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -12234,7 +12234,7 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/defaultView) */ - readonly defaultView: (WindowProxy & typeof globalThis) | null; + readonly defaultView: Globalized | null; /** * **`document.designMode`** controls whether the entire document is editable. Valid values are "on" and "off". According to the specification, this property is meant to default to "off". Firefox follows this standard. The earlier versions of Chrome and IE default to "inherit". Starting in Chrome 43, the default is "off" and "inherit" is no longer supported. In IE6-10, the value is capitalized. * @@ -39699,7 +39699,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/self) */ - readonly self: Window & typeof globalThis; + readonly self: Globalized; /** * The **`speechSynthesis`** read-only property of the Window object returns a SpeechSynthesis object, which is the entry point into using Web Speech API speech synthesis functionality. * @@ -39742,7 +39742,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/window) */ - readonly window: Window & typeof globalThis; + readonly window: Globalized; /** * **`window.alert()`** instructs the browser to display a dialog with an optional message, and to wait until the user dismisses the dialog. * @@ -41881,7 +41881,7 @@ declare var scrollbars: BarProp; * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/self) */ -declare var self: Window & typeof globalThis; +declare var self: Globalized; /** * The **`speechSynthesis`** read-only property of the Window object returns a SpeechSynthesis object, which is the entry point into using Web Speech API speech synthesis functionality. * @@ -41924,7 +41924,7 @@ declare var visualViewport: VisualViewport | null; * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/window) */ -declare var window: Window & typeof globalThis; +declare var window: Globalized; /** * **`window.alert()`** instructs the browser to display a dialog with an optional message, and to wait until the user dismisses the dialog. * @@ -42450,6 +42450,7 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; +type Globalized = T & typeof globalThis; type HTMLOrSVGImageElement = HTMLImageElement | SVGImageElement; type HTMLOrSVGScriptElement = HTMLScriptElement | SVGScriptElement; type HashAlgorithmIdentifier = AlgorithmIdentifier; diff --git a/baselines/serviceworker.generated.d.ts b/baselines/serviceworker.generated.d.ts index 34a0420d5..14bc7eaa7 100644 --- a/baselines/serviceworker.generated.d.ts +++ b/baselines/serviceworker.generated.d.ts @@ -10867,7 +10867,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: WorkerGlobalScope & typeof globalThis; + readonly self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11666,7 +11666,7 @@ declare var onunhandledrejection: ((this: ServiceWorkerGlobalScope, ev: PromiseR * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: WorkerGlobalScope & typeof globalThis; +declare var self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11758,6 +11758,7 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; +type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/sharedworker.generated.d.ts b/baselines/sharedworker.generated.d.ts index 7823b51d8..350f9ddc3 100644 --- a/baselines/sharedworker.generated.d.ts +++ b/baselines/sharedworker.generated.d.ts @@ -10400,7 +10400,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: WorkerGlobalScope & typeof globalThis; + readonly self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11350,7 +11350,7 @@ declare var onunhandledrejection: ((this: SharedWorkerGlobalScope, ev: PromiseRe * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: WorkerGlobalScope & typeof globalThis; +declare var self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11441,6 +11441,7 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; +type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.5/dom.generated.d.ts b/baselines/ts5.5/dom.generated.d.ts index d10659836..b62fc77db 100644 --- a/baselines/ts5.5/dom.generated.d.ts +++ b/baselines/ts5.5/dom.generated.d.ts @@ -12223,7 +12223,7 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/defaultView) */ - readonly defaultView: (WindowProxy & typeof globalThis) | null; + readonly defaultView: Globalized | null; /** * **`document.designMode`** controls whether the entire document is editable. Valid values are "on" and "off". According to the specification, this property is meant to default to "off". Firefox follows this standard. The earlier versions of Chrome and IE default to "inherit". Starting in Chrome 43, the default is "off" and "inherit" is no longer supported. In IE6-10, the value is capitalized. * @@ -39673,7 +39673,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/self) */ - readonly self: Window & typeof globalThis; + readonly self: Globalized; /** * The **`speechSynthesis`** read-only property of the Window object returns a SpeechSynthesis object, which is the entry point into using Web Speech API speech synthesis functionality. * @@ -39716,7 +39716,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/window) */ - readonly window: Window & typeof globalThis; + readonly window: Globalized; /** * **`window.alert()`** instructs the browser to display a dialog with an optional message, and to wait until the user dismisses the dialog. * @@ -41855,7 +41855,7 @@ declare var scrollbars: BarProp; * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/self) */ -declare var self: Window & typeof globalThis; +declare var self: Globalized; /** * The **`speechSynthesis`** read-only property of the Window object returns a SpeechSynthesis object, which is the entry point into using Web Speech API speech synthesis functionality. * @@ -41898,7 +41898,7 @@ declare var visualViewport: VisualViewport | null; * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/window) */ -declare var window: Window & typeof globalThis; +declare var window: Globalized; /** * **`window.alert()`** instructs the browser to display a dialog with an optional message, and to wait until the user dismisses the dialog. * @@ -42424,6 +42424,7 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; +type Globalized = T & typeof globalThis; type HTMLOrSVGImageElement = HTMLImageElement | SVGImageElement; type HTMLOrSVGScriptElement = HTMLScriptElement | SVGScriptElement; type HashAlgorithmIdentifier = AlgorithmIdentifier; diff --git a/baselines/ts5.5/serviceworker.generated.d.ts b/baselines/ts5.5/serviceworker.generated.d.ts index 0f65044c1..24e015d5e 100644 --- a/baselines/ts5.5/serviceworker.generated.d.ts +++ b/baselines/ts5.5/serviceworker.generated.d.ts @@ -10864,7 +10864,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: WorkerGlobalScope & typeof globalThis; + readonly self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11663,7 +11663,7 @@ declare var onunhandledrejection: ((this: ServiceWorkerGlobalScope, ev: PromiseR * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: WorkerGlobalScope & typeof globalThis; +declare var self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11755,6 +11755,7 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; +type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.5/sharedworker.generated.d.ts b/baselines/ts5.5/sharedworker.generated.d.ts index 46dfb828d..563d15c8e 100644 --- a/baselines/ts5.5/sharedworker.generated.d.ts +++ b/baselines/ts5.5/sharedworker.generated.d.ts @@ -10397,7 +10397,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: WorkerGlobalScope & typeof globalThis; + readonly self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11347,7 +11347,7 @@ declare var onunhandledrejection: ((this: SharedWorkerGlobalScope, ev: PromiseRe * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: WorkerGlobalScope & typeof globalThis; +declare var self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11438,6 +11438,7 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; +type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.5/webworker.generated.d.ts b/baselines/ts5.5/webworker.generated.d.ts index efa73bc12..8d9c7fe45 100644 --- a/baselines/ts5.5/webworker.generated.d.ts +++ b/baselines/ts5.5/webworker.generated.d.ts @@ -12351,7 +12351,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: WorkerGlobalScope & typeof globalThis; + readonly self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -13332,7 +13332,7 @@ declare var onunhandledrejection: ((this: DedicatedWorkerGlobalScope, ev: Promis * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: WorkerGlobalScope & typeof globalThis; +declare var self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -13432,6 +13432,7 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; +type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.6/dom.generated.d.ts b/baselines/ts5.6/dom.generated.d.ts index 2e5b922e6..5a65b6325 100644 --- a/baselines/ts5.6/dom.generated.d.ts +++ b/baselines/ts5.6/dom.generated.d.ts @@ -12231,7 +12231,7 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/defaultView) */ - readonly defaultView: (WindowProxy & typeof globalThis) | null; + readonly defaultView: Globalized | null; /** * **`document.designMode`** controls whether the entire document is editable. Valid values are "on" and "off". According to the specification, this property is meant to default to "off". Firefox follows this standard. The earlier versions of Chrome and IE default to "inherit". Starting in Chrome 43, the default is "off" and "inherit" is no longer supported. In IE6-10, the value is capitalized. * @@ -39696,7 +39696,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/self) */ - readonly self: Window & typeof globalThis; + readonly self: Globalized; /** * The **`speechSynthesis`** read-only property of the Window object returns a SpeechSynthesis object, which is the entry point into using Web Speech API speech synthesis functionality. * @@ -39739,7 +39739,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/window) */ - readonly window: Window & typeof globalThis; + readonly window: Globalized; /** * **`window.alert()`** instructs the browser to display a dialog with an optional message, and to wait until the user dismisses the dialog. * @@ -41878,7 +41878,7 @@ declare var scrollbars: BarProp; * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/self) */ -declare var self: Window & typeof globalThis; +declare var self: Globalized; /** * The **`speechSynthesis`** read-only property of the Window object returns a SpeechSynthesis object, which is the entry point into using Web Speech API speech synthesis functionality. * @@ -41921,7 +41921,7 @@ declare var visualViewport: VisualViewport | null; * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/window) */ -declare var window: Window & typeof globalThis; +declare var window: Globalized; /** * **`window.alert()`** instructs the browser to display a dialog with an optional message, and to wait until the user dismisses the dialog. * @@ -42447,6 +42447,7 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; +type Globalized = T & typeof globalThis; type HTMLOrSVGImageElement = HTMLImageElement | SVGImageElement; type HTMLOrSVGScriptElement = HTMLScriptElement | SVGScriptElement; type HashAlgorithmIdentifier = AlgorithmIdentifier; diff --git a/baselines/ts5.6/serviceworker.generated.d.ts b/baselines/ts5.6/serviceworker.generated.d.ts index 0f65044c1..24e015d5e 100644 --- a/baselines/ts5.6/serviceworker.generated.d.ts +++ b/baselines/ts5.6/serviceworker.generated.d.ts @@ -10864,7 +10864,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: WorkerGlobalScope & typeof globalThis; + readonly self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11663,7 +11663,7 @@ declare var onunhandledrejection: ((this: ServiceWorkerGlobalScope, ev: PromiseR * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: WorkerGlobalScope & typeof globalThis; +declare var self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11755,6 +11755,7 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; +type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.6/sharedworker.generated.d.ts b/baselines/ts5.6/sharedworker.generated.d.ts index 46dfb828d..563d15c8e 100644 --- a/baselines/ts5.6/sharedworker.generated.d.ts +++ b/baselines/ts5.6/sharedworker.generated.d.ts @@ -10397,7 +10397,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: WorkerGlobalScope & typeof globalThis; + readonly self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11347,7 +11347,7 @@ declare var onunhandledrejection: ((this: SharedWorkerGlobalScope, ev: PromiseRe * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: WorkerGlobalScope & typeof globalThis; +declare var self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11438,6 +11438,7 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; +type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.6/webworker.generated.d.ts b/baselines/ts5.6/webworker.generated.d.ts index efa73bc12..8d9c7fe45 100644 --- a/baselines/ts5.6/webworker.generated.d.ts +++ b/baselines/ts5.6/webworker.generated.d.ts @@ -12351,7 +12351,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: WorkerGlobalScope & typeof globalThis; + readonly self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -13332,7 +13332,7 @@ declare var onunhandledrejection: ((this: DedicatedWorkerGlobalScope, ev: Promis * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: WorkerGlobalScope & typeof globalThis; +declare var self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -13432,6 +13432,7 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; +type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.9/dom.generated.d.ts b/baselines/ts5.9/dom.generated.d.ts index 3773a12d8..651fd2bf0 100644 --- a/baselines/ts5.9/dom.generated.d.ts +++ b/baselines/ts5.9/dom.generated.d.ts @@ -12231,7 +12231,7 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/defaultView) */ - readonly defaultView: (WindowProxy & typeof globalThis) | null; + readonly defaultView: Globalized | null; /** * **`document.designMode`** controls whether the entire document is editable. Valid values are "on" and "off". According to the specification, this property is meant to default to "off". Firefox follows this standard. The earlier versions of Chrome and IE default to "inherit". Starting in Chrome 43, the default is "off" and "inherit" is no longer supported. In IE6-10, the value is capitalized. * @@ -39696,7 +39696,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/self) */ - readonly self: Window & typeof globalThis; + readonly self: Globalized; /** * The **`speechSynthesis`** read-only property of the Window object returns a SpeechSynthesis object, which is the entry point into using Web Speech API speech synthesis functionality. * @@ -39739,7 +39739,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/window) */ - readonly window: Window & typeof globalThis; + readonly window: Globalized; /** * **`window.alert()`** instructs the browser to display a dialog with an optional message, and to wait until the user dismisses the dialog. * @@ -41878,7 +41878,7 @@ declare var scrollbars: BarProp; * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/self) */ -declare var self: Window & typeof globalThis; +declare var self: Globalized; /** * The **`speechSynthesis`** read-only property of the Window object returns a SpeechSynthesis object, which is the entry point into using Web Speech API speech synthesis functionality. * @@ -41921,7 +41921,7 @@ declare var visualViewport: VisualViewport | null; * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/window) */ -declare var window: Window & typeof globalThis; +declare var window: Globalized; /** * **`window.alert()`** instructs the browser to display a dialog with an optional message, and to wait until the user dismisses the dialog. * @@ -42447,6 +42447,7 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; +type Globalized = T & typeof globalThis; type HTMLOrSVGImageElement = HTMLImageElement | SVGImageElement; type HTMLOrSVGScriptElement = HTMLScriptElement | SVGScriptElement; type HashAlgorithmIdentifier = AlgorithmIdentifier; diff --git a/baselines/ts5.9/serviceworker.generated.d.ts b/baselines/ts5.9/serviceworker.generated.d.ts index cdab0dd43..fead3a4f6 100644 --- a/baselines/ts5.9/serviceworker.generated.d.ts +++ b/baselines/ts5.9/serviceworker.generated.d.ts @@ -10864,7 +10864,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: WorkerGlobalScope & typeof globalThis; + readonly self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11663,7 +11663,7 @@ declare var onunhandledrejection: ((this: ServiceWorkerGlobalScope, ev: PromiseR * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: WorkerGlobalScope & typeof globalThis; +declare var self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11755,6 +11755,7 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; +type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.9/sharedworker.generated.d.ts b/baselines/ts5.9/sharedworker.generated.d.ts index 6278b060f..d0bb27ad2 100644 --- a/baselines/ts5.9/sharedworker.generated.d.ts +++ b/baselines/ts5.9/sharedworker.generated.d.ts @@ -10397,7 +10397,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: WorkerGlobalScope & typeof globalThis; + readonly self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11347,7 +11347,7 @@ declare var onunhandledrejection: ((this: SharedWorkerGlobalScope, ev: PromiseRe * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: WorkerGlobalScope & typeof globalThis; +declare var self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11438,6 +11438,7 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; +type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.9/webworker.generated.d.ts b/baselines/ts5.9/webworker.generated.d.ts index bc0fa5a19..b7c7ce087 100644 --- a/baselines/ts5.9/webworker.generated.d.ts +++ b/baselines/ts5.9/webworker.generated.d.ts @@ -12351,7 +12351,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: WorkerGlobalScope & typeof globalThis; + readonly self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -13332,7 +13332,7 @@ declare var onunhandledrejection: ((this: DedicatedWorkerGlobalScope, ev: Promis * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: WorkerGlobalScope & typeof globalThis; +declare var self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -13432,6 +13432,7 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; +type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/webworker.generated.d.ts b/baselines/webworker.generated.d.ts index 3b22ffbf9..cfc7f908e 100644 --- a/baselines/webworker.generated.d.ts +++ b/baselines/webworker.generated.d.ts @@ -12354,7 +12354,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: WorkerGlobalScope & typeof globalThis; + readonly self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -13335,7 +13335,7 @@ declare var onunhandledrejection: ((this: DedicatedWorkerGlobalScope, ev: Promis * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: WorkerGlobalScope & typeof globalThis; +declare var self: Globalized; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -13435,6 +13435,7 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; +type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/inputfiles/overridingTypes.jsonc b/inputfiles/overridingTypes.jsonc index 1e86d1786..af78932f2 100644 --- a/inputfiles/overridingTypes.jsonc +++ b/inputfiles/overridingTypes.jsonc @@ -408,12 +408,6 @@ "onorientationchange": { "deprecated": true }, - "self": { - "overrideType": "Window & typeof globalThis" - }, - "window": { - "overrideType": "Window & typeof globalThis" - }, "pageXOffset": { // While this is indeed an alias of scrollX, it's not a vendor prefixed legacy as aliases usually are. "deprecated": false @@ -539,10 +533,6 @@ }, "properties": { "property": { - "defaultView": { - "name": "defaultView", - "overrideType": "WindowProxy & typeof globalThis" - }, "documentElement": { "name": "documentElement", "overrideType": "HTMLElement", @@ -2798,13 +2788,6 @@ } }, "WorkerGlobalScope": { - "properties": { - "property": { - "self": { - "overrideType": "WorkerGlobalScope & typeof globalThis" - } - } - }, "events": { "event": [ { diff --git a/inputfiles/patches/dom.kdl b/inputfiles/patches/dom.kdl index 146a24389..4a1652375 100644 --- a/inputfiles/patches/dom.kdl +++ b/inputfiles/patches/dom.kdl @@ -11,6 +11,14 @@ interface EventListenerObject noInterfaceObject=#true { } } +interface Document { + property defaultView { + type Globalized { + type WindowProxy + } + } +} + enum InsertPosition { beforebegin beforeend diff --git a/inputfiles/patches/html.kdl b/inputfiles/patches/html.kdl index 00b0380a4..c4118b611 100644 --- a/inputfiles/patches/html.kdl +++ b/inputfiles/patches/html.kdl @@ -69,8 +69,25 @@ interface HTMLInputElement { } } +interface Window { + property self type=Globalized + property window type=Globalized +} + +interface WorkerGlobalScope { + property self { + type Globalized { + type WorkerGlobalScope + } + } +} + typedef SelectionDirection overrideType=#""forward" | "backward" | "none""# +typedef Globalized overrideType="T & typeof globalThis" { + typeParameters T default="Window" +} + dictionary StructuredSerializeOptions { member transfer { type { diff --git a/src/build/patches.ts b/src/build/patches.ts index f2484e436..ba3efae53 100644 --- a/src/build/patches.ts +++ b/src/build/patches.ts @@ -448,9 +448,25 @@ function handleMember(c: Node): DeepPartial { * @param node The typedef node to handle. */ function handleTypedef(node: Node): DeepPartial { - const typeNodes = node.children.filter((c) => c.name === "type"); + // Support type params: collect "type" and "typeParameters" child nodes + const typeNodes: Node[] = []; + let typeParameters = {}; + + for (const c of node.children) { + switch (c.name) { + case "type": + typeNodes.push(c); + break; + case "typeParameters": + typeParameters = handleTypeParameters(c); + break; + default: + throw new Error(`Unexpected child "${c.name}"`); + } + } return { name: string(node.values[0]), + ...typeParameters, ...handleTyped(typeNodes), ...optionalMember( "legacyNamespace", From dedd12838c5ed47c753542d4d21fc4511b4ab6b2 Mon Sep 17 00:00:00 2001 From: Bashamega Date: Wed, 31 Dec 2025 07:51:01 +0200 Subject: [PATCH 2/2] fix build --- baselines/serviceworker.generated.d.ts | 5 ++--- baselines/sharedworker.generated.d.ts | 5 ++--- baselines/ts5.5/serviceworker.generated.d.ts | 5 ++--- baselines/ts5.5/sharedworker.generated.d.ts | 5 ++--- baselines/ts5.5/webworker.generated.d.ts | 5 ++--- baselines/ts5.6/serviceworker.generated.d.ts | 5 ++--- baselines/ts5.6/sharedworker.generated.d.ts | 5 ++--- baselines/ts5.6/webworker.generated.d.ts | 5 ++--- baselines/ts5.9/serviceworker.generated.d.ts | 5 ++--- baselines/ts5.9/sharedworker.generated.d.ts | 5 ++--- baselines/ts5.9/webworker.generated.d.ts | 5 ++--- baselines/webworker.generated.d.ts | 5 ++--- inputfiles/patches/html.kdl | 7 ++----- 13 files changed, 26 insertions(+), 41 deletions(-) diff --git a/baselines/serviceworker.generated.d.ts b/baselines/serviceworker.generated.d.ts index 14bc7eaa7..34a0420d5 100644 --- a/baselines/serviceworker.generated.d.ts +++ b/baselines/serviceworker.generated.d.ts @@ -10867,7 +10867,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: Globalized; + readonly self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11666,7 +11666,7 @@ declare var onunhandledrejection: ((this: ServiceWorkerGlobalScope, ev: PromiseR * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: Globalized; +declare var self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11758,7 +11758,6 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; -type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/sharedworker.generated.d.ts b/baselines/sharedworker.generated.d.ts index 350f9ddc3..7823b51d8 100644 --- a/baselines/sharedworker.generated.d.ts +++ b/baselines/sharedworker.generated.d.ts @@ -10400,7 +10400,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: Globalized; + readonly self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11350,7 +11350,7 @@ declare var onunhandledrejection: ((this: SharedWorkerGlobalScope, ev: PromiseRe * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: Globalized; +declare var self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11441,7 +11441,6 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; -type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.5/serviceworker.generated.d.ts b/baselines/ts5.5/serviceworker.generated.d.ts index 24e015d5e..0f65044c1 100644 --- a/baselines/ts5.5/serviceworker.generated.d.ts +++ b/baselines/ts5.5/serviceworker.generated.d.ts @@ -10864,7 +10864,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: Globalized; + readonly self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11663,7 +11663,7 @@ declare var onunhandledrejection: ((this: ServiceWorkerGlobalScope, ev: PromiseR * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: Globalized; +declare var self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11755,7 +11755,6 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; -type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.5/sharedworker.generated.d.ts b/baselines/ts5.5/sharedworker.generated.d.ts index 563d15c8e..46dfb828d 100644 --- a/baselines/ts5.5/sharedworker.generated.d.ts +++ b/baselines/ts5.5/sharedworker.generated.d.ts @@ -10397,7 +10397,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: Globalized; + readonly self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11347,7 +11347,7 @@ declare var onunhandledrejection: ((this: SharedWorkerGlobalScope, ev: PromiseRe * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: Globalized; +declare var self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11438,7 +11438,6 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; -type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.5/webworker.generated.d.ts b/baselines/ts5.5/webworker.generated.d.ts index 8d9c7fe45..efa73bc12 100644 --- a/baselines/ts5.5/webworker.generated.d.ts +++ b/baselines/ts5.5/webworker.generated.d.ts @@ -12351,7 +12351,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: Globalized; + readonly self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -13332,7 +13332,7 @@ declare var onunhandledrejection: ((this: DedicatedWorkerGlobalScope, ev: Promis * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: Globalized; +declare var self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -13432,7 +13432,6 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; -type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.6/serviceworker.generated.d.ts b/baselines/ts5.6/serviceworker.generated.d.ts index 24e015d5e..0f65044c1 100644 --- a/baselines/ts5.6/serviceworker.generated.d.ts +++ b/baselines/ts5.6/serviceworker.generated.d.ts @@ -10864,7 +10864,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: Globalized; + readonly self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11663,7 +11663,7 @@ declare var onunhandledrejection: ((this: ServiceWorkerGlobalScope, ev: PromiseR * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: Globalized; +declare var self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11755,7 +11755,6 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; -type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.6/sharedworker.generated.d.ts b/baselines/ts5.6/sharedworker.generated.d.ts index 563d15c8e..46dfb828d 100644 --- a/baselines/ts5.6/sharedworker.generated.d.ts +++ b/baselines/ts5.6/sharedworker.generated.d.ts @@ -10397,7 +10397,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: Globalized; + readonly self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11347,7 +11347,7 @@ declare var onunhandledrejection: ((this: SharedWorkerGlobalScope, ev: PromiseRe * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: Globalized; +declare var self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11438,7 +11438,6 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; -type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.6/webworker.generated.d.ts b/baselines/ts5.6/webworker.generated.d.ts index 8d9c7fe45..efa73bc12 100644 --- a/baselines/ts5.6/webworker.generated.d.ts +++ b/baselines/ts5.6/webworker.generated.d.ts @@ -12351,7 +12351,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: Globalized; + readonly self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -13332,7 +13332,7 @@ declare var onunhandledrejection: ((this: DedicatedWorkerGlobalScope, ev: Promis * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: Globalized; +declare var self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -13432,7 +13432,6 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; -type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.9/serviceworker.generated.d.ts b/baselines/ts5.9/serviceworker.generated.d.ts index fead3a4f6..cdab0dd43 100644 --- a/baselines/ts5.9/serviceworker.generated.d.ts +++ b/baselines/ts5.9/serviceworker.generated.d.ts @@ -10864,7 +10864,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: Globalized; + readonly self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11663,7 +11663,7 @@ declare var onunhandledrejection: ((this: ServiceWorkerGlobalScope, ev: PromiseR * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: Globalized; +declare var self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11755,7 +11755,6 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; -type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.9/sharedworker.generated.d.ts b/baselines/ts5.9/sharedworker.generated.d.ts index d0bb27ad2..6278b060f 100644 --- a/baselines/ts5.9/sharedworker.generated.d.ts +++ b/baselines/ts5.9/sharedworker.generated.d.ts @@ -10397,7 +10397,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: Globalized; + readonly self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11347,7 +11347,7 @@ declare var onunhandledrejection: ((this: SharedWorkerGlobalScope, ev: PromiseRe * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: Globalized; +declare var self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -11438,7 +11438,6 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; -type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/ts5.9/webworker.generated.d.ts b/baselines/ts5.9/webworker.generated.d.ts index b7c7ce087..bc0fa5a19 100644 --- a/baselines/ts5.9/webworker.generated.d.ts +++ b/baselines/ts5.9/webworker.generated.d.ts @@ -12351,7 +12351,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: Globalized; + readonly self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -13332,7 +13332,7 @@ declare var onunhandledrejection: ((this: DedicatedWorkerGlobalScope, ev: Promis * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: Globalized; +declare var self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -13432,7 +13432,6 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; -type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/baselines/webworker.generated.d.ts b/baselines/webworker.generated.d.ts index cfc7f908e..3b22ffbf9 100644 --- a/baselines/webworker.generated.d.ts +++ b/baselines/webworker.generated.d.ts @@ -12354,7 +12354,7 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ - readonly self: Globalized; + readonly self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -13335,7 +13335,7 @@ declare var onunhandledrejection: ((this: DedicatedWorkerGlobalScope, ev: Promis * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/self) */ -declare var self: Globalized; +declare var self: WorkerGlobalScope & typeof globalThis; /** * The **`importScripts()`** method of the WorkerGlobalScope interface synchronously imports one or more scripts into the worker's scope. * @@ -13435,7 +13435,6 @@ type GLsizei = number; type GLsizeiptr = number; type GLuint = number; type GLuint64 = number; -type Globalized = T & typeof globalThis; type HashAlgorithmIdentifier = AlgorithmIdentifier; type HeadersInit = [string, string][] | Record | Headers; type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; diff --git a/inputfiles/patches/html.kdl b/inputfiles/patches/html.kdl index c4118b611..5ef00f86a 100644 --- a/inputfiles/patches/html.kdl +++ b/inputfiles/patches/html.kdl @@ -75,11 +75,8 @@ interface Window { } interface WorkerGlobalScope { - property self { - type Globalized { - type WorkerGlobalScope - } - } + // We must declare it in overrideType, because Window doesn't exist in WebWorkers + property self overrideType="WorkerGlobalScope & typeof globalThis" } typedef SelectionDirection overrideType=#""forward" | "backward" | "none""#