From 7d9b0c33ac30d29446c63957fa31aeb8948042f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9?= Date: Wed, 1 Oct 2025 00:28:01 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#73786=20[node]=20w?= =?UTF-8?q?orker=5Fthreads:=20linearise=20MessagePort=20heritage=20graph?= =?UTF-8?q?=20by=20@Renegade334?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/node/events.d.ts | 33 ---------------------------- types/node/v18/events.d.ts | 35 ------------------------------ types/node/v18/worker_threads.d.ts | 2 +- types/node/v20/events.d.ts | 33 ---------------------------- types/node/v20/worker_threads.d.ts | 2 +- types/node/v22/events.d.ts | 33 ---------------------------- types/node/v22/worker_threads.d.ts | 2 +- types/node/worker_threads.d.ts | 2 +- 8 files changed, 4 insertions(+), 138 deletions(-) diff --git a/types/node/events.d.ts b/types/node/events.d.ts index ba4ef7a4387966..b6bfd5fb28a8cc 100644 --- a/types/node/events.d.ts +++ b/types/node/events.d.ts @@ -36,39 +36,6 @@ */ declare module "events" { import { AsyncResource, AsyncResourceOptions } from "node:async_hooks"; - // NOTE: This class is in the docs but is **not actually exported** by Node. - // If https://github.com/nodejs/node/issues/39903 gets resolved and Node - // actually starts exporting the class, uncomment below. - // import { EventListener, EventListenerObject } from '__dom-events'; - // /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */ - // interface NodeEventTarget extends EventTarget { - // /** - // * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API. - // * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget. - // */ - // addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; - // /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */ - // eventNames(): string[]; - // /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */ - // listenerCount(type: string): number; - // /** Node.js-specific alias for `eventTarget.removeListener()`. */ - // off(type: string, listener: EventListener | EventListenerObject): this; - // /** Node.js-specific alias for `eventTarget.addListener()`. */ - // on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; - // /** Node.js-specific extension to the `EventTarget` class that adds a `once` listener for the given event `type`. This is equivalent to calling `on` with the `once` option set to `true`. */ - // once(type: string, listener: EventListener | EventListenerObject): this; - // /** - // * Node.js-specific extension to the `EventTarget` class. - // * If `type` is specified, removes all registered listeners for `type`, - // * otherwise removes all registered listeners. - // */ - // removeAllListeners(type: string): this; - // /** - // * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`. - // * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`. - // */ - // removeListener(type: string, listener: EventListener | EventListenerObject): this; - // } interface EventEmitterOptions { /** * Enables automatic capturing of promise rejection. diff --git a/types/node/v18/events.d.ts b/types/node/v18/events.d.ts index 73dff2f70c1c3b..9c67ad42108b46 100644 --- a/types/node/v18/events.d.ts +++ b/types/node/v18/events.d.ts @@ -37,41 +37,6 @@ declare module "events" { import { AsyncResource, AsyncResourceOptions } from "node:async_hooks"; - // NOTE: This class is in the docs but is **not actually exported** by Node. - // If https://github.com/nodejs/node/issues/39903 gets resolved and Node - // actually starts exporting the class, uncomment below. - - // import { EventListener, EventListenerObject } from '__dom-events'; - // /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */ - // interface NodeEventTarget extends EventTarget { - // /** - // * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API. - // * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget. - // */ - // addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; - // /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */ - // eventNames(): string[]; - // /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */ - // listenerCount(type: string): number; - // /** Node.js-specific alias for `eventTarget.removeListener()`. */ - // off(type: string, listener: EventListener | EventListenerObject): this; - // /** Node.js-specific alias for `eventTarget.addListener()`. */ - // on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; - // /** Node.js-specific extension to the `EventTarget` class that adds a `once` listener for the given event `type`. This is equivalent to calling `on` with the `once` option set to `true`. */ - // once(type: string, listener: EventListener | EventListenerObject): this; - // /** - // * Node.js-specific extension to the `EventTarget` class. - // * If `type` is specified, removes all registered listeners for `type`, - // * otherwise removes all registered listeners. - // */ - // removeAllListeners(type: string): this; - // /** - // * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`. - // * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`. - // */ - // removeListener(type: string, listener: EventListener | EventListenerObject): this; - // } - interface EventEmitterOptions { /** * Enables automatic capturing of promise rejection. diff --git a/types/node/v18/worker_threads.d.ts b/types/node/v18/worker_threads.d.ts index 2d9aa81e2b5af0..eff18064be6c60 100644 --- a/types/node/v18/worker_threads.d.ts +++ b/types/node/v18/worker_threads.d.ts @@ -106,7 +106,7 @@ declare module "worker_threads" { * This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s. * @since v10.5.0 */ - class MessagePort extends EventTarget { + class MessagePort implements EventTarget { /** * Disables further sending of messages on either side of the connection. * This method can be called when no further communication will happen over this`MessagePort`. diff --git a/types/node/v20/events.d.ts b/types/node/v20/events.d.ts index 613f1cf21a876b..c17dd168a041a1 100644 --- a/types/node/v20/events.d.ts +++ b/types/node/v20/events.d.ts @@ -36,39 +36,6 @@ */ declare module "events" { import { AsyncResource, AsyncResourceOptions } from "node:async_hooks"; - // NOTE: This class is in the docs but is **not actually exported** by Node. - // If https://github.com/nodejs/node/issues/39903 gets resolved and Node - // actually starts exporting the class, uncomment below. - // import { EventListener, EventListenerObject } from '__dom-events'; - // /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */ - // interface NodeEventTarget extends EventTarget { - // /** - // * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API. - // * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget. - // */ - // addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; - // /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */ - // eventNames(): string[]; - // /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */ - // listenerCount(type: string): number; - // /** Node.js-specific alias for `eventTarget.removeListener()`. */ - // off(type: string, listener: EventListener | EventListenerObject): this; - // /** Node.js-specific alias for `eventTarget.addListener()`. */ - // on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; - // /** Node.js-specific extension to the `EventTarget` class that adds a `once` listener for the given event `type`. This is equivalent to calling `on` with the `once` option set to `true`. */ - // once(type: string, listener: EventListener | EventListenerObject): this; - // /** - // * Node.js-specific extension to the `EventTarget` class. - // * If `type` is specified, removes all registered listeners for `type`, - // * otherwise removes all registered listeners. - // */ - // removeAllListeners(type: string): this; - // /** - // * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`. - // * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`. - // */ - // removeListener(type: string, listener: EventListener | EventListenerObject): this; - // } interface EventEmitterOptions { /** * Enables automatic capturing of promise rejection. diff --git a/types/node/v20/worker_threads.d.ts b/types/node/v20/worker_threads.d.ts index 251fd9f23763db..4fa73fdeb358e7 100644 --- a/types/node/v20/worker_threads.d.ts +++ b/types/node/v20/worker_threads.d.ts @@ -106,7 +106,7 @@ declare module "worker_threads" { * This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s. * @since v10.5.0 */ - class MessagePort extends EventTarget { + class MessagePort implements EventTarget { /** * Disables further sending of messages on either side of the connection. * This method can be called when no further communication will happen over this `MessagePort`. diff --git a/types/node/v22/events.d.ts b/types/node/v22/events.d.ts index b31a7bc183a356..c8bae9aff7a9fd 100644 --- a/types/node/v22/events.d.ts +++ b/types/node/v22/events.d.ts @@ -36,39 +36,6 @@ */ declare module "events" { import { AsyncResource, AsyncResourceOptions } from "node:async_hooks"; - // NOTE: This class is in the docs but is **not actually exported** by Node. - // If https://github.com/nodejs/node/issues/39903 gets resolved and Node - // actually starts exporting the class, uncomment below. - // import { EventListener, EventListenerObject } from '__dom-events'; - // /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */ - // interface NodeEventTarget extends EventTarget { - // /** - // * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API. - // * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget. - // */ - // addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; - // /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */ - // eventNames(): string[]; - // /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */ - // listenerCount(type: string): number; - // /** Node.js-specific alias for `eventTarget.removeListener()`. */ - // off(type: string, listener: EventListener | EventListenerObject): this; - // /** Node.js-specific alias for `eventTarget.addListener()`. */ - // on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; - // /** Node.js-specific extension to the `EventTarget` class that adds a `once` listener for the given event `type`. This is equivalent to calling `on` with the `once` option set to `true`. */ - // once(type: string, listener: EventListener | EventListenerObject): this; - // /** - // * Node.js-specific extension to the `EventTarget` class. - // * If `type` is specified, removes all registered listeners for `type`, - // * otherwise removes all registered listeners. - // */ - // removeAllListeners(type: string): this; - // /** - // * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`. - // * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`. - // */ - // removeListener(type: string, listener: EventListener | EventListenerObject): this; - // } interface EventEmitterOptions { /** * Enables automatic capturing of promise rejection. diff --git a/types/node/v22/worker_threads.d.ts b/types/node/v22/worker_threads.d.ts index cb362da92b355c..39cf89373f83da 100644 --- a/types/node/v22/worker_threads.d.ts +++ b/types/node/v22/worker_threads.d.ts @@ -111,7 +111,7 @@ declare module "worker_threads" { * This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s. * @since v10.5.0 */ - class MessagePort extends EventTarget { + class MessagePort implements EventTarget { /** * Disables further sending of messages on either side of the connection. * This method can be called when no further communication will happen over this `MessagePort`. diff --git a/types/node/worker_threads.d.ts b/types/node/worker_threads.d.ts index f04c14f4ba6196..e3350f3df1f427 100644 --- a/types/node/worker_threads.d.ts +++ b/types/node/worker_threads.d.ts @@ -113,7 +113,7 @@ declare module "worker_threads" { * This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s. * @since v10.5.0 */ - class MessagePort extends EventTarget { + class MessagePort implements EventTarget { /** * Disables further sending of messages on either side of the connection. * This method can be called when no further communication will happen over this `MessagePort`.