@types/node 18.19.127 → 18.19.129

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
node v18.19/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v18.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Thu, 18 Sep 2025 00:04:03 GMT
11
+ * Last updated: Tue, 30 Sep 2025 23:32:16 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
node v18.19/assert.d.ts CHANGED
@@ -11,6 +11,24 @@ declare module "assert" {
11
11
  */
12
12
  function assert(value: unknown, message?: string | Error): asserts value;
13
13
  namespace assert {
14
+ type AssertMethodNames =
15
+ | "deepEqual"
16
+ | "deepStrictEqual"
17
+ | "doesNotMatch"
18
+ | "doesNotReject"
19
+ | "doesNotThrow"
20
+ | "equal"
21
+ | "fail"
22
+ | "ifError"
23
+ | "match"
24
+ | "notDeepEqual"
25
+ | "notDeepStrictEqual"
26
+ | "notEqual"
27
+ | "notStrictEqual"
28
+ | "ok"
29
+ | "rejects"
30
+ | "strictEqual"
31
+ | "throws";
14
32
  /**
15
33
  * Indicates the failure of an assertion. All errors thrown by the `assert` module
16
34
  * will be instances of the `AssertionError` class.
node v18.19/events.d.ts CHANGED
@@ -37,41 +37,6 @@
37
37
  declare module "events" {
38
38
  import { AsyncResource, AsyncResourceOptions } from "node:async_hooks";
39
39
 
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
-
75
40
  interface EventEmitterOptions {
76
41
  /**
77
42
  * Enables automatic capturing of promise rejection.
@@ -479,6 +444,85 @@ declare module "events" {
479
444
  /** The underlying AsyncResource */
480
445
  readonly asyncResource: EventEmitterReferencingAsyncResource;
481
446
  }
447
+ /**
448
+ * The `NodeEventTarget` is a Node.js-specific extension to `EventTarget`
449
+ * that emulates a subset of the `EventEmitter` API.
450
+ * @since v14.5.0
451
+ */
452
+ export interface NodeEventTarget extends EventTarget {
453
+ /**
454
+ * Node.js-specific extension to the `EventTarget` class that emulates the
455
+ * equivalent `EventEmitter` API. The only difference between `addListener()` and
456
+ * `addEventListener()` is that `addListener()` will return a reference to the
457
+ * `EventTarget`.
458
+ * @since v14.5.0
459
+ */
460
+ addListener(type: string, listener: (arg: any) => void): this;
461
+ /**
462
+ * Node.js-specific extension to the `EventTarget` class that dispatches the
463
+ * `arg` to the list of handlers for `type`.
464
+ * @since v15.2.0
465
+ * @returns `true` if event listeners registered for the `type` exist,
466
+ * otherwise `false`.
467
+ */
468
+ emit(type: string, arg: any): boolean;
469
+ /**
470
+ * Node.js-specific extension to the `EventTarget` class that returns an array
471
+ * of event `type` names for which event listeners are registered.
472
+ * @since 14.5.0
473
+ */
474
+ eventNames(): string[];
475
+ /**
476
+ * Node.js-specific extension to the `EventTarget` class that returns the number
477
+ * of event listeners registered for the `type`.
478
+ * @since v14.5.0
479
+ */
480
+ listenerCount(type: string): number;
481
+ /**
482
+ * Node.js-specific extension to the `EventTarget` class that sets the number
483
+ * of max event listeners as `n`.
484
+ * @since v14.5.0
485
+ */
486
+ setMaxListeners(n: number): void;
487
+ /**
488
+ * Node.js-specific extension to the `EventTarget` class that returns the number
489
+ * of max event listeners.
490
+ * @since v14.5.0
491
+ */
492
+ getMaxListeners(): number;
493
+ /**
494
+ * Node.js-specific alias for `eventTarget.removeEventListener()`.
495
+ * @since v14.5.0
496
+ */
497
+ off(type: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
498
+ /**
499
+ * Node.js-specific alias for `eventTarget.addEventListener()`.
500
+ * @since v14.5.0
501
+ */
502
+ on(type: string, listener: (arg: any) => void): this;
503
+ /**
504
+ * Node.js-specific extension to the `EventTarget` class that adds a `once`
505
+ * listener for the given event `type`. This is equivalent to calling `on`
506
+ * with the `once` option set to `true`.
507
+ * @since v14.5.0
508
+ */
509
+ once(type: string, listener: (arg: any) => void): this;
510
+ /**
511
+ * Node.js-specific extension to the `EventTarget` class. If `type` is specified,
512
+ * removes all registered listeners for `type`, otherwise removes all registered
513
+ * listeners.
514
+ * @since v14.5.0
515
+ */
516
+ removeAllListeners(type?: string): this;
517
+ /**
518
+ * Node.js-specific extension to the `EventTarget` class that removes the
519
+ * `listener` for the given `type`. The only difference between `removeListener()`
520
+ * and `removeEventListener()` is that `removeListener()` will return a reference
521
+ * to the `EventTarget`.
522
+ * @since v14.5.0
523
+ */
524
+ removeListener(type: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
525
+ }
482
526
  }
483
527
  global {
484
528
  namespace NodeJS {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.19.127",
3
+ "version": "18.19.129",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -140,6 +140,6 @@
140
140
  "undici-types": "~5.26.4"
141
141
  },
142
142
  "peerDependencies": {},
143
- "typesPublisherContentHash": "7633adf99df0dc9e54b5f2153381f9440d33af8d950953d4c85c436e21dfdefb",
143
+ "typesPublisherContentHash": "5268f34ded8d8d019f21d1a511a77ff2bdab3fa6a2fdd75cff9bf4c87f0f8a10",
144
144
  "typeScriptVersion": "5.2"
145
145
  }
@@ -42,6 +42,7 @@ interface EventListenerObject {
42
42
  handleEvent(object: Event): void;
43
43
  }
44
44
 
45
+ type _EventListenerOptions = typeof globalThis extends { onmessage: any } ? {} : EventListenerOptions;
45
46
  interface EventListenerOptions {
46
47
  capture?: boolean;
47
48
  }
@@ -69,6 +70,8 @@ declare global {
69
70
  new(type: string, eventInitDict?: EventInit): Event;
70
71
  };
71
72
 
73
+ interface EventListenerOptions extends _EventListenerOptions {}
74
+
72
75
  interface EventTarget extends _EventTarget {}
73
76
  var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
74
77
  : {
@@ -53,7 +53,7 @@
53
53
  */
54
54
  declare module "worker_threads" {
55
55
  import { Context } from "node:vm";
56
- import { EventEmitter } from "node:events";
56
+ import { EventEmitter, NodeEventTarget } from "node:events";
57
57
  import { EventLoopUtilityFunction } from "node:perf_hooks";
58
58
  import { FileHandle } from "node:fs/promises";
59
59
  import { Readable, Writable } from "node:stream";
@@ -106,7 +106,7 @@ declare module "worker_threads" {
106
106
  * This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
107
107
  * @since v10.5.0
108
108
  */
109
- class MessagePort extends EventEmitter {
109
+ class MessagePort implements EventTarget {
110
110
  /**
111
111
  * Disables further sending of messages on either side of the connection.
112
112
  * This method can be called when no further communication will happen over this`MessagePort`.
@@ -214,42 +214,32 @@ declare module "worker_threads" {
214
214
  * @since v10.5.0
215
215
  */
216
216
  start(): void;
217
- addListener(event: "close", listener: () => void): this;
217
+ addListener(event: "close", listener: (ev: Event) => void): this;
218
218
  addListener(event: "message", listener: (value: any) => void): this;
219
219
  addListener(event: "messageerror", listener: (error: Error) => void): this;
220
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
221
- emit(event: "close"): boolean;
220
+ addListener(event: string, listener: (arg: any) => void): this;
221
+ emit(event: "close", ev: Event): boolean;
222
222
  emit(event: "message", value: any): boolean;
223
223
  emit(event: "messageerror", error: Error): boolean;
224
- emit(event: string | symbol, ...args: any[]): boolean;
225
- on(event: "close", listener: () => void): this;
224
+ emit(event: string, arg: any): boolean;
225
+ off(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
226
+ off(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
227
+ off(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
228
+ off(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
229
+ on(event: "close", listener: (ev: Event) => void): this;
226
230
  on(event: "message", listener: (value: any) => void): this;
227
231
  on(event: "messageerror", listener: (error: Error) => void): this;
228
- on(event: string | symbol, listener: (...args: any[]) => void): this;
229
- once(event: "close", listener: () => void): this;
232
+ on(event: string, listener: (arg: any) => void): this;
233
+ once(event: "close", listener: (ev: Event) => void): this;
230
234
  once(event: "message", listener: (value: any) => void): this;
231
235
  once(event: "messageerror", listener: (error: Error) => void): this;
232
- once(event: string | symbol, listener: (...args: any[]) => void): this;
233
- prependListener(event: "close", listener: () => void): this;
234
- prependListener(event: "message", listener: (value: any) => void): this;
235
- prependListener(event: "messageerror", listener: (error: Error) => void): this;
236
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
237
- prependOnceListener(event: "close", listener: () => void): this;
238
- prependOnceListener(event: "message", listener: (value: any) => void): this;
239
- prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
240
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
241
- removeListener(event: "close", listener: () => void): this;
242
- removeListener(event: "message", listener: (value: any) => void): this;
243
- removeListener(event: "messageerror", listener: (error: Error) => void): this;
244
- removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
245
- off(event: "close", listener: () => void): this;
246
- off(event: "message", listener: (value: any) => void): this;
247
- off(event: "messageerror", listener: (error: Error) => void): this;
248
- off(event: string | symbol, listener: (...args: any[]) => void): this;
249
- addEventListener: EventTarget["addEventListener"];
250
- dispatchEvent: EventTarget["dispatchEvent"];
251
- removeEventListener: EventTarget["removeEventListener"];
236
+ once(event: string, listener: (arg: any) => void): this;
237
+ removeListener(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
238
+ removeListener(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
239
+ removeListener(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
240
+ removeListener(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
252
241
  }
242
+ interface MessagePort extends NodeEventTarget {}
253
243
  interface WorkerOptions {
254
244
  /**
255
245
  * List of arguments which would be stringified and appended to