@types/node 18.19.127 → 18.19.128

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: Mon, 29 Sep 2025 18:40: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
@@ -479,6 +479,85 @@ declare module "events" {
479
479
  /** The underlying AsyncResource */
480
480
  readonly asyncResource: EventEmitterReferencingAsyncResource;
481
481
  }
482
+ /**
483
+ * The `NodeEventTarget` is a Node.js-specific extension to `EventTarget`
484
+ * that emulates a subset of the `EventEmitter` API.
485
+ * @since v14.5.0
486
+ */
487
+ export interface NodeEventTarget extends EventTarget {
488
+ /**
489
+ * Node.js-specific extension to the `EventTarget` class that emulates the
490
+ * equivalent `EventEmitter` API. The only difference between `addListener()` and
491
+ * `addEventListener()` is that `addListener()` will return a reference to the
492
+ * `EventTarget`.
493
+ * @since v14.5.0
494
+ */
495
+ addListener(type: string, listener: (arg: any) => void): this;
496
+ /**
497
+ * Node.js-specific extension to the `EventTarget` class that dispatches the
498
+ * `arg` to the list of handlers for `type`.
499
+ * @since v15.2.0
500
+ * @returns `true` if event listeners registered for the `type` exist,
501
+ * otherwise `false`.
502
+ */
503
+ emit(type: string, arg: any): boolean;
504
+ /**
505
+ * Node.js-specific extension to the `EventTarget` class that returns an array
506
+ * of event `type` names for which event listeners are registered.
507
+ * @since 14.5.0
508
+ */
509
+ eventNames(): string[];
510
+ /**
511
+ * Node.js-specific extension to the `EventTarget` class that returns the number
512
+ * of event listeners registered for the `type`.
513
+ * @since v14.5.0
514
+ */
515
+ listenerCount(type: string): number;
516
+ /**
517
+ * Node.js-specific extension to the `EventTarget` class that sets the number
518
+ * of max event listeners as `n`.
519
+ * @since v14.5.0
520
+ */
521
+ setMaxListeners(n: number): void;
522
+ /**
523
+ * Node.js-specific extension to the `EventTarget` class that returns the number
524
+ * of max event listeners.
525
+ * @since v14.5.0
526
+ */
527
+ getMaxListeners(): number;
528
+ /**
529
+ * Node.js-specific alias for `eventTarget.removeEventListener()`.
530
+ * @since v14.5.0
531
+ */
532
+ off(type: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
533
+ /**
534
+ * Node.js-specific alias for `eventTarget.addEventListener()`.
535
+ * @since v14.5.0
536
+ */
537
+ on(type: string, listener: (arg: any) => void): this;
538
+ /**
539
+ * Node.js-specific extension to the `EventTarget` class that adds a `once`
540
+ * listener for the given event `type`. This is equivalent to calling `on`
541
+ * with the `once` option set to `true`.
542
+ * @since v14.5.0
543
+ */
544
+ once(type: string, listener: (arg: any) => void): this;
545
+ /**
546
+ * Node.js-specific extension to the `EventTarget` class. If `type` is specified,
547
+ * removes all registered listeners for `type`, otherwise removes all registered
548
+ * listeners.
549
+ * @since v14.5.0
550
+ */
551
+ removeAllListeners(type?: string): this;
552
+ /**
553
+ * Node.js-specific extension to the `EventTarget` class that removes the
554
+ * `listener` for the given `type`. The only difference between `removeListener()`
555
+ * and `removeEventListener()` is that `removeListener()` will return a reference
556
+ * to the `EventTarget`.
557
+ * @since v14.5.0
558
+ */
559
+ removeListener(type: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
560
+ }
482
561
  }
483
562
  global {
484
563
  namespace NodeJS {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.19.127",
3
+ "version": "18.19.128",
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": "3ac487f87d519fece73bcbb72fc17890f38b0f74e75551eb795948e9f026d92f",
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 extends 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