@types/node 20.19.17 → 20.19.19
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 v20.19/README.md +1 -1
- node v20.19/assert.d.ts +18 -0
- node v20.19/events.d.ts +79 -33
- node v20.19/package.json +2 -2
- node v20.19/test.d.ts +2 -22
- node v20.19/web-globals/events.d.ts +3 -0
- node v20.19/worker_threads.d.ts +19 -47
node v20.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/v20.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated:
|
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 v20.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 `node:assert` module will be instances of the `AssertionError` class.
|
16
34
|
*/
|
node v20.19/events.d.ts
CHANGED
@@ -36,39 +36,6 @@
|
|
36
36
|
*/
|
37
37
|
declare module "events" {
|
38
38
|
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
|
-
// }
|
72
39
|
interface EventEmitterOptions {
|
73
40
|
/**
|
74
41
|
* Enables automatic capturing of promise rejection.
|
@@ -585,6 +552,85 @@ declare module "events" {
|
|
585
552
|
*/
|
586
553
|
readonly asyncResource: EventEmitterReferencingAsyncResource;
|
587
554
|
}
|
555
|
+
/**
|
556
|
+
* The `NodeEventTarget` is a Node.js-specific extension to `EventTarget`
|
557
|
+
* that emulates a subset of the `EventEmitter` API.
|
558
|
+
* @since v14.5.0
|
559
|
+
*/
|
560
|
+
export interface NodeEventTarget extends EventTarget {
|
561
|
+
/**
|
562
|
+
* Node.js-specific extension to the `EventTarget` class that emulates the
|
563
|
+
* equivalent `EventEmitter` API. The only difference between `addListener()` and
|
564
|
+
* `addEventListener()` is that `addListener()` will return a reference to the
|
565
|
+
* `EventTarget`.
|
566
|
+
* @since v14.5.0
|
567
|
+
*/
|
568
|
+
addListener(type: string, listener: (arg: any) => void): this;
|
569
|
+
/**
|
570
|
+
* Node.js-specific extension to the `EventTarget` class that dispatches the
|
571
|
+
* `arg` to the list of handlers for `type`.
|
572
|
+
* @since v15.2.0
|
573
|
+
* @returns `true` if event listeners registered for the `type` exist,
|
574
|
+
* otherwise `false`.
|
575
|
+
*/
|
576
|
+
emit(type: string, arg: any): boolean;
|
577
|
+
/**
|
578
|
+
* Node.js-specific extension to the `EventTarget` class that returns an array
|
579
|
+
* of event `type` names for which event listeners are registered.
|
580
|
+
* @since 14.5.0
|
581
|
+
*/
|
582
|
+
eventNames(): string[];
|
583
|
+
/**
|
584
|
+
* Node.js-specific extension to the `EventTarget` class that returns the number
|
585
|
+
* of event listeners registered for the `type`.
|
586
|
+
* @since v14.5.0
|
587
|
+
*/
|
588
|
+
listenerCount(type: string): number;
|
589
|
+
/**
|
590
|
+
* Node.js-specific extension to the `EventTarget` class that sets the number
|
591
|
+
* of max event listeners as `n`.
|
592
|
+
* @since v14.5.0
|
593
|
+
*/
|
594
|
+
setMaxListeners(n: number): void;
|
595
|
+
/**
|
596
|
+
* Node.js-specific extension to the `EventTarget` class that returns the number
|
597
|
+
* of max event listeners.
|
598
|
+
* @since v14.5.0
|
599
|
+
*/
|
600
|
+
getMaxListeners(): number;
|
601
|
+
/**
|
602
|
+
* Node.js-specific alias for `eventTarget.removeEventListener()`.
|
603
|
+
* @since v14.5.0
|
604
|
+
*/
|
605
|
+
off(type: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
|
606
|
+
/**
|
607
|
+
* Node.js-specific alias for `eventTarget.addEventListener()`.
|
608
|
+
* @since v14.5.0
|
609
|
+
*/
|
610
|
+
on(type: string, listener: (arg: any) => void): this;
|
611
|
+
/**
|
612
|
+
* Node.js-specific extension to the `EventTarget` class that adds a `once`
|
613
|
+
* listener for the given event `type`. This is equivalent to calling `on`
|
614
|
+
* with the `once` option set to `true`.
|
615
|
+
* @since v14.5.0
|
616
|
+
*/
|
617
|
+
once(type: string, listener: (arg: any) => void): this;
|
618
|
+
/**
|
619
|
+
* Node.js-specific extension to the `EventTarget` class. If `type` is specified,
|
620
|
+
* removes all registered listeners for `type`, otherwise removes all registered
|
621
|
+
* listeners.
|
622
|
+
* @since v14.5.0
|
623
|
+
*/
|
624
|
+
removeAllListeners(type?: string): this;
|
625
|
+
/**
|
626
|
+
* Node.js-specific extension to the `EventTarget` class that removes the
|
627
|
+
* `listener` for the given `type`. The only difference between `removeListener()`
|
628
|
+
* and `removeEventListener()` is that `removeListener()` will return a reference
|
629
|
+
* to the `EventTarget`.
|
630
|
+
* @since v14.5.0
|
631
|
+
*/
|
632
|
+
removeListener(type: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
|
633
|
+
}
|
588
634
|
}
|
589
635
|
global {
|
590
636
|
namespace NodeJS {
|
node v20.19/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/node",
|
3
|
-
"version": "20.19.
|
3
|
+
"version": "20.19.19",
|
4
4
|
"description": "TypeScript definitions for node",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
6
6
|
"license": "MIT",
|
@@ -135,6 +135,6 @@
|
|
135
135
|
"undici-types": "~6.21.0"
|
136
136
|
},
|
137
137
|
"peerDependencies": {},
|
138
|
-
"typesPublisherContentHash": "
|
138
|
+
"typesPublisherContentHash": "f137b9afbfbc3918867ab07269ee57c43fa45f74d9054590bed60377448b37ef",
|
139
139
|
"typeScriptVersion": "5.2"
|
140
140
|
}
|
node v20.19/test.d.ts
CHANGED
@@ -79,6 +79,7 @@
|
|
79
79
|
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/test.js)
|
80
80
|
*/
|
81
81
|
declare module "node:test" {
|
82
|
+
import { AssertMethodNames } from "node:assert";
|
82
83
|
import { Readable } from "node:stream";
|
83
84
|
import TestFn = test.TestFn;
|
84
85
|
import TestOptions = test.TestOptions;
|
@@ -933,28 +934,7 @@ declare module "node:test" {
|
|
933
934
|
*/
|
934
935
|
readonly mock: MockTracker;
|
935
936
|
}
|
936
|
-
interface TestContextAssert extends
|
937
|
-
Pick<
|
938
|
-
typeof import("assert"),
|
939
|
-
| "deepEqual"
|
940
|
-
| "deepStrictEqual"
|
941
|
-
| "doesNotMatch"
|
942
|
-
| "doesNotReject"
|
943
|
-
| "doesNotThrow"
|
944
|
-
| "equal"
|
945
|
-
| "fail"
|
946
|
-
| "ifError"
|
947
|
-
| "match"
|
948
|
-
| "notDeepEqual"
|
949
|
-
| "notDeepStrictEqual"
|
950
|
-
| "notEqual"
|
951
|
-
| "notStrictEqual"
|
952
|
-
| "ok"
|
953
|
-
| "rejects"
|
954
|
-
| "strictEqual"
|
955
|
-
| "throws"
|
956
|
-
>
|
957
|
-
{}
|
937
|
+
interface TestContextAssert extends Pick<typeof import("assert"), AssertMethodNames> {}
|
958
938
|
/**
|
959
939
|
* An instance of `SuiteContext` is passed to each suite function in order to
|
960
940
|
* interact with the test runner. However, the `SuiteContext` constructor is not
|
@@ -51,6 +51,7 @@ interface EventListenerObject {
|
|
51
51
|
handleEvent(object: Event): void;
|
52
52
|
}
|
53
53
|
|
54
|
+
type _EventListenerOptions = typeof globalThis extends { onmessage: any } ? {} : EventListenerOptions;
|
54
55
|
interface EventListenerOptions {
|
55
56
|
capture?: boolean;
|
56
57
|
}
|
@@ -85,6 +86,8 @@ declare global {
|
|
85
86
|
new(type: string, eventInitDict?: EventInit): Event;
|
86
87
|
};
|
87
88
|
|
89
|
+
interface EventListenerOptions extends _EventListenerOptions {}
|
90
|
+
|
88
91
|
interface EventTarget extends _EventTarget {}
|
89
92
|
var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
|
90
93
|
: {
|
node v20.19/worker_threads.d.ts
CHANGED
@@ -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
|
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
|
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
|
225
|
-
|
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
|
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
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
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
|
@@ -418,24 +408,6 @@ declare module "worker_threads" {
|
|
418
408
|
* @since v10.5.0
|
419
409
|
*/
|
420
410
|
postMessage(value: any, transferList?: readonly Transferable[]): void;
|
421
|
-
/**
|
422
|
-
* Sends a value to another worker, identified by its thread ID.
|
423
|
-
* @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
|
424
|
-
* If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
|
425
|
-
* @param value The value to send.
|
426
|
-
* @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
|
427
|
-
* or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
|
428
|
-
* @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
|
429
|
-
* If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
|
430
|
-
* @since v20.19.0
|
431
|
-
*/
|
432
|
-
postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
|
433
|
-
postMessageToThread(
|
434
|
-
threadId: number,
|
435
|
-
value: any,
|
436
|
-
transferList: readonly Transferable[],
|
437
|
-
timeout?: number,
|
438
|
-
): Promise<void>;
|
439
411
|
/**
|
440
412
|
* Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker does _not_ let the program exit if it's the only active handle left (the default
|
441
413
|
* behavior). If the worker is `ref()`ed, calling `ref()` again has
|