Skip to content

Commit 7d9b0c3

Browse files
authored
🤖 Merge PR DefinitelyTyped#73786 [node] worker_threads: linearise MessagePort heritage graph by @Renegade334
1 parent a8ba211 commit 7d9b0c3

File tree

8 files changed

+4
-138
lines changed

8 files changed

+4
-138
lines changed

‎types/node/events.d.ts‎

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -36,39 +36,6 @@
3636
*/
3737
declare module "events" {
3838
import { AsyncResource, AsyncResourceOptions } from "node:async_hooks";
39-
// NOTE: This class is in the docs but is **not actually exported** by Node.
40-
// If https://github.com/nodejs/node/issues/39903 gets resolved and Node
41-
// actually starts exporting the class, uncomment below.
42-
// import { EventListener, EventListenerObject } from '__dom-events';
43-
// /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */
44-
// interface NodeEventTarget extends EventTarget {
45-
// /**
46-
// * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API.
47-
// * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget.
48-
// */
49-
// addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
50-
// /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */
51-
// eventNames(): string[];
52-
// /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */
53-
// listenerCount(type: string): number;
54-
// /** Node.js-specific alias for `eventTarget.removeListener()`. */
55-
// off(type: string, listener: EventListener | EventListenerObject): this;
56-
// /** Node.js-specific alias for `eventTarget.addListener()`. */
57-
// on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
58-
// /** 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`. */
59-
// once(type: string, listener: EventListener | EventListenerObject): this;
60-
// /**
61-
// * Node.js-specific extension to the `EventTarget` class.
62-
// * If `type` is specified, removes all registered listeners for `type`,
63-
// * otherwise removes all registered listeners.
64-
// */
65-
// removeAllListeners(type: string): this;
66-
// /**
67-
// * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`.
68-
// * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`.
69-
// */
70-
// removeListener(type: string, listener: EventListener | EventListenerObject): this;
71-
// }
7239
interface EventEmitterOptions {
7340
/**
7441
* Enables automatic capturing of promise rejection.

‎types/node/v18/events.d.ts‎

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -37,41 +37,6 @@
3737
declare module "events" {
3838
import { AsyncResource, AsyncResourceOptions } from "node:async_hooks";
3939

40-
// NOTE: This class is in the docs but is **not actually exported** by Node.
41-
// If https://github.com/nodejs/node/issues/39903 gets resolved and Node
42-
// actually starts exporting the class, uncomment below.
43-
44-
// import { EventListener, EventListenerObject } from '__dom-events';
45-
// /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */
46-
// interface NodeEventTarget extends EventTarget {
47-
// /**
48-
// * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API.
49-
// * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget.
50-
// */
51-
// addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
52-
// /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */
53-
// eventNames(): string[];
54-
// /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */
55-
// listenerCount(type: string): number;
56-
// /** Node.js-specific alias for `eventTarget.removeListener()`. */
57-
// off(type: string, listener: EventListener | EventListenerObject): this;
58-
// /** Node.js-specific alias for `eventTarget.addListener()`. */
59-
// on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
60-
// /** 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`. */
61-
// once(type: string, listener: EventListener | EventListenerObject): this;
62-
// /**
63-
// * Node.js-specific extension to the `EventTarget` class.
64-
// * If `type` is specified, removes all registered listeners for `type`,
65-
// * otherwise removes all registered listeners.
66-
// */
67-
// removeAllListeners(type: string): this;
68-
// /**
69-
// * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`.
70-
// * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`.
71-
// */
72-
// removeListener(type: string, listener: EventListener | EventListenerObject): this;
73-
// }
74-
7540
interface EventEmitterOptions {
7641
/**
7742
* Enables automatic capturing of promise rejection.

‎types/node/v18/worker_threads.d.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ declare module "worker_threads" {
106106
* This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
107107
* @since v10.5.0
108108
*/
109-
class MessagePort extends EventTarget {
109+
class MessagePort implements EventTarget {
110110
/**
111111
* Disables further sending of messages on either side of the connection.
112112
* This method can be called when no further communication will happen over this`MessagePort`.

‎types/node/v20/events.d.ts‎

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -36,39 +36,6 @@
3636
*/
3737
declare module "events" {
3838
import { AsyncResource, AsyncResourceOptions } from "node:async_hooks";
39-
// NOTE: This class is in the docs but is **not actually exported** by Node.
40-
// If https://github.com/nodejs/node/issues/39903 gets resolved and Node
41-
// actually starts exporting the class, uncomment below.
42-
// import { EventListener, EventListenerObject } from '__dom-events';
43-
// /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */
44-
// interface NodeEventTarget extends EventTarget {
45-
// /**
46-
// * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API.
47-
// * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget.
48-
// */
49-
// addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
50-
// /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */
51-
// eventNames(): string[];
52-
// /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */
53-
// listenerCount(type: string): number;
54-
// /** Node.js-specific alias for `eventTarget.removeListener()`. */
55-
// off(type: string, listener: EventListener | EventListenerObject): this;
56-
// /** Node.js-specific alias for `eventTarget.addListener()`. */
57-
// on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
58-
// /** 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`. */
59-
// once(type: string, listener: EventListener | EventListenerObject): this;
60-
// /**
61-
// * Node.js-specific extension to the `EventTarget` class.
62-
// * If `type` is specified, removes all registered listeners for `type`,
63-
// * otherwise removes all registered listeners.
64-
// */
65-
// removeAllListeners(type: string): this;
66-
// /**
67-
// * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`.
68-
// * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`.
69-
// */
70-
// removeListener(type: string, listener: EventListener | EventListenerObject): this;
71-
// }
7239
interface EventEmitterOptions {
7340
/**
7441
* Enables automatic capturing of promise rejection.

‎types/node/v20/worker_threads.d.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ declare module "worker_threads" {
106106
* This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
107107
* @since v10.5.0
108108
*/
109-
class MessagePort extends EventTarget {
109+
class MessagePort implements EventTarget {
110110
/**
111111
* Disables further sending of messages on either side of the connection.
112112
* This method can be called when no further communication will happen over this `MessagePort`.

‎types/node/v22/events.d.ts‎

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -36,39 +36,6 @@
3636
*/
3737
declare module "events" {
3838
import { AsyncResource, AsyncResourceOptions } from "node:async_hooks";
39-
// NOTE: This class is in the docs but is **not actually exported** by Node.
40-
// If https://github.com/nodejs/node/issues/39903 gets resolved and Node
41-
// actually starts exporting the class, uncomment below.
42-
// import { EventListener, EventListenerObject } from '__dom-events';
43-
// /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */
44-
// interface NodeEventTarget extends EventTarget {
45-
// /**
46-
// * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API.
47-
// * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget.
48-
// */
49-
// addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
50-
// /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */
51-
// eventNames(): string[];
52-
// /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */
53-
// listenerCount(type: string): number;
54-
// /** Node.js-specific alias for `eventTarget.removeListener()`. */
55-
// off(type: string, listener: EventListener | EventListenerObject): this;
56-
// /** Node.js-specific alias for `eventTarget.addListener()`. */
57-
// on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
58-
// /** 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`. */
59-
// once(type: string, listener: EventListener | EventListenerObject): this;
60-
// /**
61-
// * Node.js-specific extension to the `EventTarget` class.
62-
// * If `type` is specified, removes all registered listeners for `type`,
63-
// * otherwise removes all registered listeners.
64-
// */
65-
// removeAllListeners(type: string): this;
66-
// /**
67-
// * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`.
68-
// * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`.
69-
// */
70-
// removeListener(type: string, listener: EventListener | EventListenerObject): this;
71-
// }
7239
interface EventEmitterOptions {
7340
/**
7441
* Enables automatic capturing of promise rejection.

‎types/node/v22/worker_threads.d.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ declare module "worker_threads" {
111111
* This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
112112
* @since v10.5.0
113113
*/
114-
class MessagePort extends EventTarget {
114+
class MessagePort implements EventTarget {
115115
/**
116116
* Disables further sending of messages on either side of the connection.
117117
* This method can be called when no further communication will happen over this `MessagePort`.

‎types/node/worker_threads.d.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ declare module "worker_threads" {
113113
* This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
114114
* @since v10.5.0
115115
*/
116-
class MessagePort extends EventTarget {
116+
class MessagePort implements EventTarget {
117117
/**
118118
* Disables further sending of messages on either side of the connection.
119119
* This method can be called when no further communication will happen over this `MessagePort`.

0 commit comments

Comments
 (0)