Skip to content

Commit

Permalink
Switch to this: T for MessagePort and immediate subtypes
Browse files Browse the repository at this point in the history
Should allow more variance in non-immediate subtypes
  • Loading branch information
sandersn committed Jan 22, 2025
1 parent d08731b commit b858667
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/lib/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16389,11 +16389,11 @@ interface MessageEventTargetEventMap {
"messageerror": MessageEvent;
}

interface MessageEventTarget {
interface MessageEventTarget<T> {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DedicatedWorkerGlobalScope/message_event) */
onmessage: ((this: this, ev: MessageEvent) => any) | null;
onmessage: ((this: T, ev: MessageEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DedicatedWorkerGlobalScope/messageerror_event) */
onmessageerror: ((this: this, ev: MessageEvent) => any) | null;
onmessageerror: ((this: T, ev: MessageEvent) => any) | null;
addEventListener<K extends keyof MessageEventTargetEventMap>(type: K, listener: (this: MessageEventTarget, ev: MessageEventTargetEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof MessageEventTargetEventMap>(type: K, listener: (this: MessageEventTarget, ev: MessageEventTargetEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
Expand All @@ -16410,7 +16410,7 @@ interface MessagePortEventMap extends MessageEventTargetEventMap {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
*/
interface MessagePort extends EventTarget, MessageEventTarget {
interface MessagePort extends EventTarget, MessageEventTarget<MessagePort> {
/**
* Disconnects the port, so that it is no longer active.
*
Expand Down Expand Up @@ -27268,7 +27268,7 @@ interface WorkerEventMap extends AbstractWorkerEventMap, MessageEventTargetEvent
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Worker)
*/
interface Worker extends EventTarget, AbstractWorker, MessageEventTarget {
interface Worker extends EventTarget, AbstractWorker, MessageEventTarget<Worker> {
/**
* Clones message and transmits it to worker's global environment. transfer can be passed as a list of objects that are to be transferred rather than cloned.
*
Expand Down
12 changes: 6 additions & 6 deletions src/lib/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2497,7 +2497,7 @@ interface DedicatedWorkerGlobalScopeEventMap extends WorkerGlobalScopeEventMap,
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DedicatedWorkerGlobalScope)
*/
interface DedicatedWorkerGlobalScope extends WorkerGlobalScope, AnimationFrameProvider, MessageEventTarget {
interface DedicatedWorkerGlobalScope extends WorkerGlobalScope, AnimationFrameProvider, MessageEventTarget<DedicatedWorkerGlobalScope> {
/**
* Returns dedicatedWorkerGlobal's name, i.e. the value given to the Worker constructor. Primarily useful for debugging.
*
Expand Down Expand Up @@ -4333,11 +4333,11 @@ interface MessageEventTargetEventMap {
"messageerror": MessageEvent;
}

interface MessageEventTarget {
interface MessageEventTarget<T> {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DedicatedWorkerGlobalScope/message_event) */
onmessage: ((this: this, ev: MessageEvent) => any) | null;
onmessage: ((this: T, ev: MessageEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DedicatedWorkerGlobalScope/messageerror_event) */
onmessageerror: ((this: this, ev: MessageEvent) => any) | null;
onmessageerror: ((this: T, ev: MessageEvent) => any) | null;
addEventListener<K extends keyof MessageEventTargetEventMap>(type: K, listener: (this: MessageEventTarget, ev: MessageEventTargetEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof MessageEventTargetEventMap>(type: K, listener: (this: MessageEventTarget, ev: MessageEventTargetEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
Expand All @@ -4354,7 +4354,7 @@ interface MessagePortEventMap extends MessageEventTargetEventMap {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
*/
interface MessagePort extends EventTarget, MessageEventTarget {
interface MessagePort extends EventTarget, MessageEventTarget<MessagePort> {
/**
* Disconnects the port, so that it is no longer active.
*
Expand Down Expand Up @@ -8929,7 +8929,7 @@ interface WorkerEventMap extends AbstractWorkerEventMap, MessageEventTargetEvent
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Worker)
*/
interface Worker extends EventTarget, AbstractWorker, MessageEventTarget {
interface Worker extends EventTarget, AbstractWorker, MessageEventTarget<Worker> {
/**
* Clones message and transmits it to worker's global environment. transfer can be passed as a list of objects that are to be transferred rather than cloned.
*
Expand Down

0 comments on commit b858667

Please sign in to comment.