@types/node 18.19.122 → 18.19.124

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: Fri, 08 Aug 2025 16:38:49 GMT
11
+ * Last updated: Thu, 04 Sep 2025 10:02:38 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
@@ -66,7 +66,6 @@
66
66
  * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/child_process.js)
67
67
  */
68
68
  declare module "child_process" {
69
- import { ObjectEncodingOptions } from "node:fs";
70
69
  import { Abortable, EventEmitter } from "node:events";
71
70
  import * as net from "node:net";
72
71
  import { Pipe, Readable, Stream, Writable } from "node:stream";
@@ -889,12 +888,13 @@ declare module "child_process" {
889
888
  signal?: AbortSignal | undefined;
890
889
  maxBuffer?: number | undefined;
891
890
  killSignal?: NodeJS.Signals | number | undefined;
891
+ encoding?: string | null | undefined;
892
892
  }
893
893
  interface ExecOptionsWithStringEncoding extends ExecOptions {
894
- encoding: BufferEncoding;
894
+ encoding?: BufferEncoding | undefined;
895
895
  }
896
896
  interface ExecOptionsWithBufferEncoding extends ExecOptions {
897
- encoding: BufferEncoding | null; // specify `null`.
897
+ encoding: "buffer" | null; // specify `null`.
898
898
  }
899
899
  interface ExecException extends Error {
900
900
  cmd?: string | undefined;
@@ -995,38 +995,19 @@ declare module "child_process" {
995
995
  // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
996
996
  function exec(
997
997
  command: string,
998
- options: {
999
- encoding: "buffer" | null;
1000
- } & ExecOptions,
998
+ options: ExecOptionsWithBufferEncoding,
1001
999
  callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void,
1002
1000
  ): ChildProcess;
1003
- // `options` with well known `encoding` means stdout/stderr are definitely `string`.
1004
- function exec(
1005
- command: string,
1006
- options: {
1007
- encoding: BufferEncoding;
1008
- } & ExecOptions,
1009
- callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
1010
- ): ChildProcess;
1011
- // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
1012
- // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
1013
- function exec(
1014
- command: string,
1015
- options: {
1016
- encoding: BufferEncoding;
1017
- } & ExecOptions,
1018
- callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
1019
- ): ChildProcess;
1020
- // `options` without an `encoding` means stdout/stderr are definitely `string`.
1001
+ // `options` with well-known or absent `encoding` means stdout/stderr are definitely `string`.
1021
1002
  function exec(
1022
1003
  command: string,
1023
- options: ExecOptions,
1004
+ options: ExecOptionsWithStringEncoding,
1024
1005
  callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
1025
1006
  ): ChildProcess;
1026
1007
  // fallback if nothing else matches. Worst case is always `string | Buffer`.
1027
1008
  function exec(
1028
1009
  command: string,
1029
- options: (ObjectEncodingOptions & ExecOptions) | undefined | null,
1010
+ options: ExecOptions | undefined | null,
1030
1011
  callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
1031
1012
  ): ChildProcess;
1032
1013
  interface PromiseWithChild<T> extends Promise<T> {
@@ -1039,32 +1020,21 @@ declare module "child_process" {
1039
1020
  }>;
1040
1021
  function __promisify__(
1041
1022
  command: string,
1042
- options: {
1043
- encoding: "buffer" | null;
1044
- } & ExecOptions,
1023
+ options: ExecOptionsWithBufferEncoding,
1045
1024
  ): PromiseWithChild<{
1046
1025
  stdout: Buffer;
1047
1026
  stderr: Buffer;
1048
1027
  }>;
1049
1028
  function __promisify__(
1050
1029
  command: string,
1051
- options: {
1052
- encoding: BufferEncoding;
1053
- } & ExecOptions,
1030
+ options: ExecOptionsWithStringEncoding,
1054
1031
  ): PromiseWithChild<{
1055
1032
  stdout: string;
1056
1033
  stderr: string;
1057
1034
  }>;
1058
1035
  function __promisify__(
1059
1036
  command: string,
1060
- options: ExecOptions,
1061
- ): PromiseWithChild<{
1062
- stdout: string;
1063
- stderr: string;
1064
- }>;
1065
- function __promisify__(
1066
- command: string,
1067
- options?: (ObjectEncodingOptions & ExecOptions) | null,
1037
+ options: ExecOptions | undefined | null,
1068
1038
  ): PromiseWithChild<{
1069
1039
  stdout: string | Buffer;
1070
1040
  stderr: string | Buffer;
@@ -1076,16 +1046,16 @@ declare module "child_process" {
1076
1046
  windowsVerbatimArguments?: boolean | undefined;
1077
1047
  shell?: boolean | string | undefined;
1078
1048
  signal?: AbortSignal | undefined;
1049
+ encoding?: string | null | undefined;
1079
1050
  }
1080
1051
  interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
1081
- encoding: BufferEncoding;
1052
+ encoding?: BufferEncoding | undefined;
1082
1053
  }
1083
1054
  interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
1084
1055
  encoding: "buffer" | null;
1085
1056
  }
1086
- interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {
1087
- encoding: BufferEncoding;
1088
- }
1057
+ /** @deprecated Use `ExecFileOptions` instead. */
1058
+ interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {}
1089
1059
  type ExecFileException =
1090
1060
  & Omit<ExecException, "code">
1091
1061
  & Omit<NodeJS.ErrnoException, "code">
@@ -1154,80 +1124,44 @@ declare module "child_process" {
1154
1124
  * @param args List of string arguments.
1155
1125
  * @param callback Called with the output when process terminates.
1156
1126
  */
1157
- function execFile(file: string): ChildProcess;
1158
- function execFile(
1159
- file: string,
1160
- options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
1161
- ): ChildProcess;
1162
- function execFile(file: string, args?: readonly string[] | null): ChildProcess;
1163
- function execFile(
1164
- file: string,
1165
- args: readonly string[] | undefined | null,
1166
- options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
1167
- ): ChildProcess;
1168
1127
  // no `options` definitely means stdout/stderr are `string`.
1169
1128
  function execFile(
1170
1129
  file: string,
1171
- callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
1130
+ callback?: (error: ExecFileException | null, stdout: string, stderr: string) => void,
1172
1131
  ): ChildProcess;
1173
1132
  function execFile(
1174
1133
  file: string,
1175
1134
  args: readonly string[] | undefined | null,
1176
- callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
1135
+ callback?: (error: ExecFileException | null, stdout: string, stderr: string) => void,
1177
1136
  ): ChildProcess;
1178
1137
  // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
1179
1138
  function execFile(
1180
1139
  file: string,
1181
1140
  options: ExecFileOptionsWithBufferEncoding,
1182
- callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
1141
+ callback?: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
1183
1142
  ): ChildProcess;
1184
1143
  function execFile(
1185
1144
  file: string,
1186
1145
  args: readonly string[] | undefined | null,
1187
1146
  options: ExecFileOptionsWithBufferEncoding,
1188
- callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
1147
+ callback?: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
1189
1148
  ): ChildProcess;
1190
- // `options` with well known `encoding` means stdout/stderr are definitely `string`.
1149
+ // `options` with well-known or absent `encoding` means stdout/stderr are definitely `string`.
1191
1150
  function execFile(
1192
1151
  file: string,
1193
1152
  options: ExecFileOptionsWithStringEncoding,
1194
- callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
1153
+ callback?: (error: ExecFileException | null, stdout: string, stderr: string) => void,
1195
1154
  ): ChildProcess;
1196
1155
  function execFile(
1197
1156
  file: string,
1198
1157
  args: readonly string[] | undefined | null,
1199
1158
  options: ExecFileOptionsWithStringEncoding,
1200
- callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
1201
- ): ChildProcess;
1202
- // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
1203
- // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
1204
- function execFile(
1205
- file: string,
1206
- options: ExecFileOptionsWithOtherEncoding,
1207
- callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
1208
- ): ChildProcess;
1209
- function execFile(
1210
- file: string,
1211
- args: readonly string[] | undefined | null,
1212
- options: ExecFileOptionsWithOtherEncoding,
1213
- callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
1214
- ): ChildProcess;
1215
- // `options` without an `encoding` means stdout/stderr are definitely `string`.
1216
- function execFile(
1217
- file: string,
1218
- options: ExecFileOptions,
1219
- callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
1220
- ): ChildProcess;
1221
- function execFile(
1222
- file: string,
1223
- args: readonly string[] | undefined | null,
1224
- options: ExecFileOptions,
1225
- callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
1159
+ callback?: (error: ExecFileException | null, stdout: string, stderr: string) => void,
1226
1160
  ): ChildProcess;
1227
1161
  // fallback if nothing else matches. Worst case is always `string | Buffer`.
1228
1162
  function execFile(
1229
1163
  file: string,
1230
- options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
1164
+ options: ExecFileOptions | undefined | null,
1231
1165
  callback:
1232
1166
  | ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
1233
1167
  | undefined
@@ -1236,7 +1170,7 @@ declare module "child_process" {
1236
1170
  function execFile(
1237
1171
  file: string,
1238
1172
  args: readonly string[] | undefined | null,
1239
- options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
1173
+ options: ExecFileOptions | undefined | null,
1240
1174
  callback:
1241
1175
  | ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
1242
1176
  | undefined
@@ -1286,37 +1220,7 @@ declare module "child_process" {
1286
1220
  }>;
1287
1221
  function __promisify__(
1288
1222
  file: string,
1289
- options: ExecFileOptionsWithOtherEncoding,
1290
- ): PromiseWithChild<{
1291
- stdout: string | Buffer;
1292
- stderr: string | Buffer;
1293
- }>;
1294
- function __promisify__(
1295
- file: string,
1296
- args: readonly string[] | undefined | null,
1297
- options: ExecFileOptionsWithOtherEncoding,
1298
- ): PromiseWithChild<{
1299
- stdout: string | Buffer;
1300
- stderr: string | Buffer;
1301
- }>;
1302
- function __promisify__(
1303
- file: string,
1304
- options: ExecFileOptions,
1305
- ): PromiseWithChild<{
1306
- stdout: string;
1307
- stderr: string;
1308
- }>;
1309
- function __promisify__(
1310
- file: string,
1311
- args: readonly string[] | undefined | null,
1312
- options: ExecFileOptions,
1313
- ): PromiseWithChild<{
1314
- stdout: string;
1315
- stderr: string;
1316
- }>;
1317
- function __promisify__(
1318
- file: string,
1319
- options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
1223
+ options: ExecFileOptions | undefined | null,
1320
1224
  ): PromiseWithChild<{
1321
1225
  stdout: string | Buffer;
1322
1226
  stderr: string | Buffer;
@@ -1324,7 +1228,7 @@ declare module "child_process" {
1324
1228
  function __promisify__(
1325
1229
  file: string,
1326
1230
  args: readonly string[] | undefined | null,
1327
- options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
1231
+ options: ExecFileOptions | undefined | null,
1328
1232
  ): PromiseWithChild<{
1329
1233
  stdout: string | Buffer;
1330
1234
  stderr: string | Buffer;
@@ -1,328 +1,168 @@
1
- export {}; // Make this a module
1
+ declare var global: typeof globalThis;
2
2
 
3
- // #region Fetch and friends
4
- // Conditional type aliases, used at the end of this file.
5
- // Will either be empty if lib-dom is included, or the undici version otherwise.
6
- type _Request = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Request;
7
- type _Response = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Response;
8
- type _FormData = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").FormData;
9
- type _Headers = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Headers;
10
- type _MessageEvent = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").MessageEvent;
11
- type _RequestInit = typeof globalThis extends { onmessage: any } ? {}
12
- : import("undici-types").RequestInit;
13
- type _ResponseInit = typeof globalThis extends { onmessage: any } ? {}
14
- : import("undici-types").ResponseInit;
15
- // #endregion Fetch and friends
16
-
17
- // #region DOMException
18
- type _DOMException = typeof globalThis extends { onmessage: any } ? {} : NodeDOMException;
19
- interface NodeDOMException extends Error {
20
- readonly code: number;
21
- readonly message: string;
22
- readonly name: string;
23
- readonly INDEX_SIZE_ERR: 1;
24
- readonly DOMSTRING_SIZE_ERR: 2;
25
- readonly HIERARCHY_REQUEST_ERR: 3;
26
- readonly WRONG_DOCUMENT_ERR: 4;
27
- readonly INVALID_CHARACTER_ERR: 5;
28
- readonly NO_DATA_ALLOWED_ERR: 6;
29
- readonly NO_MODIFICATION_ALLOWED_ERR: 7;
30
- readonly NOT_FOUND_ERR: 8;
31
- readonly NOT_SUPPORTED_ERR: 9;
32
- readonly INUSE_ATTRIBUTE_ERR: 10;
33
- readonly INVALID_STATE_ERR: 11;
34
- readonly SYNTAX_ERR: 12;
35
- readonly INVALID_MODIFICATION_ERR: 13;
36
- readonly NAMESPACE_ERR: 14;
37
- readonly INVALID_ACCESS_ERR: 15;
38
- readonly VALIDATION_ERR: 16;
39
- readonly TYPE_MISMATCH_ERR: 17;
40
- readonly SECURITY_ERR: 18;
41
- readonly NETWORK_ERR: 19;
42
- readonly ABORT_ERR: 20;
43
- readonly URL_MISMATCH_ERR: 21;
44
- readonly QUOTA_EXCEEDED_ERR: 22;
45
- readonly TIMEOUT_ERR: 23;
46
- readonly INVALID_NODE_TYPE_ERR: 24;
47
- readonly DATA_CLONE_ERR: 25;
48
- }
49
- interface NodeDOMExceptionConstructor {
50
- prototype: DOMException;
51
- new(message?: string, nameOrOptions?: string | { name?: string; cause?: unknown }): DOMException;
52
- readonly INDEX_SIZE_ERR: 1;
53
- readonly DOMSTRING_SIZE_ERR: 2;
54
- readonly HIERARCHY_REQUEST_ERR: 3;
55
- readonly WRONG_DOCUMENT_ERR: 4;
56
- readonly INVALID_CHARACTER_ERR: 5;
57
- readonly NO_DATA_ALLOWED_ERR: 6;
58
- readonly NO_MODIFICATION_ALLOWED_ERR: 7;
59
- readonly NOT_FOUND_ERR: 8;
60
- readonly NOT_SUPPORTED_ERR: 9;
61
- readonly INUSE_ATTRIBUTE_ERR: 10;
62
- readonly INVALID_STATE_ERR: 11;
63
- readonly SYNTAX_ERR: 12;
64
- readonly INVALID_MODIFICATION_ERR: 13;
65
- readonly NAMESPACE_ERR: 14;
66
- readonly INVALID_ACCESS_ERR: 15;
67
- readonly VALIDATION_ERR: 16;
68
- readonly TYPE_MISMATCH_ERR: 17;
69
- readonly SECURITY_ERR: 18;
70
- readonly NETWORK_ERR: 19;
71
- readonly ABORT_ERR: 20;
72
- readonly URL_MISMATCH_ERR: 21;
73
- readonly QUOTA_EXCEEDED_ERR: 22;
74
- readonly TIMEOUT_ERR: 23;
75
- readonly INVALID_NODE_TYPE_ERR: 24;
76
- readonly DATA_CLONE_ERR: 25;
77
- }
78
- // #endregion DOMException
79
-
80
- declare global {
81
- var global: typeof globalThis;
82
-
83
- var process: NodeJS.Process;
84
- var console: Console;
85
-
86
- interface ErrorConstructor {
87
- /**
88
- * Creates a `.stack` property on `targetObject`, which when accessed returns
89
- * a string representing the location in the code at which
90
- * `Error.captureStackTrace()` was called.
91
- *
92
- * ```js
93
- * const myObject = {};
94
- * Error.captureStackTrace(myObject);
95
- * myObject.stack; // Similar to `new Error().stack`
96
- * ```
97
- *
98
- * The first line of the trace will be prefixed with
99
- * `${myObject.name}: ${myObject.message}`.
100
- *
101
- * The optional `constructorOpt` argument accepts a function. If given, all frames
102
- * above `constructorOpt`, including `constructorOpt`, will be omitted from the
103
- * generated stack trace.
104
- *
105
- * The `constructorOpt` argument is useful for hiding implementation
106
- * details of error generation from the user. For instance:
107
- *
108
- * ```js
109
- * function a() {
110
- * b();
111
- * }
112
- *
113
- * function b() {
114
- * c();
115
- * }
116
- *
117
- * function c() {
118
- * // Create an error without stack trace to avoid calculating the stack trace twice.
119
- * const { stackTraceLimit } = Error;
120
- * Error.stackTraceLimit = 0;
121
- * const error = new Error();
122
- * Error.stackTraceLimit = stackTraceLimit;
123
- *
124
- * // Capture the stack trace above function b
125
- * Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
126
- * throw error;
127
- * }
128
- *
129
- * a();
130
- * ```
131
- */
132
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
133
- /**
134
- * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
135
- */
136
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
137
- /**
138
- * The `Error.stackTraceLimit` property specifies the number of stack frames
139
- * collected by a stack trace (whether generated by `new Error().stack` or
140
- * `Error.captureStackTrace(obj)`).
141
- *
142
- * The default value is `10` but may be set to any valid JavaScript number. Changes
143
- * will affect any stack trace captured _after_ the value has been changed.
144
- *
145
- * If set to a non-number value, or set to a negative number, stack traces will
146
- * not capture any frames.
147
- */
148
- stackTraceLimit: number;
149
- }
3
+ declare var process: NodeJS.Process;
4
+ declare var console: Console;
150
5
 
6
+ interface ErrorConstructor {
151
7
  /**
152
- * Enable this API with the `--expose-gc` CLI flag.
8
+ * Creates a `.stack` property on `targetObject`, which when accessed returns
9
+ * a string representing the location in the code at which
10
+ * `Error.captureStackTrace()` was called.
11
+ *
12
+ * ```js
13
+ * const myObject = {};
14
+ * Error.captureStackTrace(myObject);
15
+ * myObject.stack; // Similar to `new Error().stack`
16
+ * ```
17
+ *
18
+ * The first line of the trace will be prefixed with
19
+ * `${myObject.name}: ${myObject.message}`.
20
+ *
21
+ * The optional `constructorOpt` argument accepts a function. If given, all frames
22
+ * above `constructorOpt`, including `constructorOpt`, will be omitted from the
23
+ * generated stack trace.
24
+ *
25
+ * The `constructorOpt` argument is useful for hiding implementation
26
+ * details of error generation from the user. For instance:
27
+ *
28
+ * ```js
29
+ * function a() {
30
+ * b();
31
+ * }
32
+ *
33
+ * function b() {
34
+ * c();
35
+ * }
36
+ *
37
+ * function c() {
38
+ * // Create an error without stack trace to avoid calculating the stack trace twice.
39
+ * const { stackTraceLimit } = Error;
40
+ * Error.stackTraceLimit = 0;
41
+ * const error = new Error();
42
+ * Error.stackTraceLimit = stackTraceLimit;
43
+ *
44
+ * // Capture the stack trace above function b
45
+ * Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
46
+ * throw error;
47
+ * }
48
+ *
49
+ * a();
50
+ * ```
153
51
  */
154
- var gc: NodeJS.GCFunction | undefined;
155
-
156
- namespace NodeJS {
157
- interface CallSite {
158
- getColumnNumber(): number | null;
159
- getEnclosingColumnNumber(): number | null;
160
- getEnclosingLineNumber(): number | null;
161
- getEvalOrigin(): string | undefined;
162
- getFileName(): string | null;
163
- getFunction(): Function | undefined;
164
- getFunctionName(): string | null;
165
- getLineNumber(): number | null;
166
- getMethodName(): string | null;
167
- getPosition(): number;
168
- getPromiseIndex(): number | null;
169
- getScriptHash(): string;
170
- getScriptNameOrSourceURL(): string | null;
171
- getThis(): unknown;
172
- getTypeName(): string | null;
173
- isAsync(): boolean;
174
- isConstructor(): boolean;
175
- isEval(): boolean;
176
- isNative(): boolean;
177
- isPromiseAll(): boolean;
178
- isToplevel(): boolean;
179
- }
180
-
181
- interface ErrnoException extends Error {
182
- errno?: number | undefined;
183
- code?: string | undefined;
184
- path?: string | undefined;
185
- syscall?: string | undefined;
186
- }
187
-
188
- interface ReadableStream extends EventEmitter {
189
- readable: boolean;
190
- read(size?: number): string | Buffer;
191
- setEncoding(encoding: BufferEncoding): this;
192
- pause(): this;
193
- resume(): this;
194
- isPaused(): boolean;
195
- pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined }): T;
196
- unpipe(destination?: WritableStream): this;
197
- unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
198
- wrap(oldStream: ReadableStream): this;
199
- [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
200
- }
201
-
202
- interface WritableStream extends EventEmitter {
203
- writable: boolean;
204
- write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
205
- write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
206
- end(cb?: () => void): this;
207
- end(data: string | Uint8Array, cb?: () => void): this;
208
- end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
209
- }
210
-
211
- interface ReadWriteStream extends ReadableStream, WritableStream {}
212
-
213
- interface RefCounted {
214
- ref(): this;
215
- unref(): this;
216
- }
217
-
218
- interface Dict<T> {
219
- [key: string]: T | undefined;
220
- }
221
-
222
- interface ReadOnlyDict<T> {
223
- readonly [key: string]: T | undefined;
224
- }
225
-
226
- interface GCFunction {
227
- (minor?: boolean): void;
228
- (options: NodeJS.GCOptions & { execution: "async" }): Promise<void>;
229
- (options: NodeJS.GCOptions): void;
230
- }
231
-
232
- interface GCOptions {
233
- execution?: "sync" | "async" | undefined;
234
- type?: "major" | "minor" | undefined;
235
- }
236
-
237
- /** An iterable iterator returned by the Node.js API. */
238
- // Default TReturn/TNext in v18 is `any`, for compatibility with the previously-used IterableIterator.
239
- interface Iterator<T, TReturn = any, TNext = any> extends IteratorObject<T, TReturn, TNext> {
240
- [Symbol.iterator](): NodeJS.Iterator<T, TReturn, TNext>;
241
- }
52
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
53
+ /**
54
+ * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
55
+ */
56
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
57
+ /**
58
+ * The `Error.stackTraceLimit` property specifies the number of stack frames
59
+ * collected by a stack trace (whether generated by `new Error().stack` or
60
+ * `Error.captureStackTrace(obj)`).
61
+ *
62
+ * The default value is `10` but may be set to any valid JavaScript number. Changes
63
+ * will affect any stack trace captured _after_ the value has been changed.
64
+ *
65
+ * If set to a non-number value, or set to a negative number, stack traces will
66
+ * not capture any frames.
67
+ */
68
+ stackTraceLimit: number;
69
+ }
242
70
 
243
- /** An async iterable iterator returned by the Node.js API. */
244
- // Default TReturn/TNext in v18 is `any`, for compatibility with the previously-used AsyncIterableIterator.
245
- interface AsyncIterator<T, TReturn = any, TNext = any> extends AsyncIteratorObject<T, TReturn, TNext> {
246
- [Symbol.asyncIterator](): NodeJS.AsyncIterator<T, TReturn, TNext>;
247
- }
71
+ /**
72
+ * Enable this API with the `--expose-gc` CLI flag.
73
+ */
74
+ declare var gc: NodeJS.GCFunction | undefined;
75
+
76
+ declare namespace NodeJS {
77
+ interface CallSite {
78
+ getColumnNumber(): number | null;
79
+ getEnclosingColumnNumber(): number | null;
80
+ getEnclosingLineNumber(): number | null;
81
+ getEvalOrigin(): string | undefined;
82
+ getFileName(): string | null;
83
+ getFunction(): Function | undefined;
84
+ getFunctionName(): string | null;
85
+ getLineNumber(): number | null;
86
+ getMethodName(): string | null;
87
+ getPosition(): number;
88
+ getPromiseIndex(): number | null;
89
+ getScriptHash(): string;
90
+ getScriptNameOrSourceURL(): string | null;
91
+ getThis(): unknown;
92
+ getTypeName(): string | null;
93
+ isAsync(): boolean;
94
+ isConstructor(): boolean;
95
+ isEval(): boolean;
96
+ isNative(): boolean;
97
+ isPromiseAll(): boolean;
98
+ isToplevel(): boolean;
248
99
  }
249
100
 
250
- // Global DOM types
251
-
252
- interface DOMException extends _DOMException {}
253
- var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
254
- : NodeDOMExceptionConstructor;
101
+ interface ErrnoException extends Error {
102
+ errno?: number | undefined;
103
+ code?: string | undefined;
104
+ path?: string | undefined;
105
+ syscall?: string | undefined;
106
+ }
255
107
 
256
- // #region AbortController
257
- interface AbortController {
258
- readonly signal: AbortSignal;
259
- abort(reason?: any): void;
108
+ interface ReadableStream extends EventEmitter {
109
+ readable: boolean;
110
+ read(size?: number): string | Buffer;
111
+ setEncoding(encoding: BufferEncoding): this;
112
+ pause(): this;
113
+ resume(): this;
114
+ isPaused(): boolean;
115
+ pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined }): T;
116
+ unpipe(destination?: WritableStream): this;
117
+ unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
118
+ wrap(oldStream: ReadableStream): this;
119
+ [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
260
120
  }
261
- var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
262
- : {
263
- prototype: AbortController;
264
- new(): AbortController;
265
- };
266
121
 
267
- interface AbortSignal extends EventTarget {
268
- readonly aborted: boolean;
269
- onabort: ((this: AbortSignal, ev: Event) => any) | null;
270
- readonly reason: any;
271
- throwIfAborted(): void;
122
+ interface WritableStream extends EventEmitter {
123
+ writable: boolean;
124
+ write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
125
+ write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
126
+ end(cb?: () => void): this;
127
+ end(data: string | Uint8Array, cb?: () => void): this;
128
+ end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
272
129
  }
273
- var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T
274
- : {
275
- prototype: AbortSignal;
276
- new(): AbortSignal;
277
- abort(reason?: any): AbortSignal;
278
- any(signals: AbortSignal[]): AbortSignal;
279
- timeout(milliseconds: number): AbortSignal;
280
- };
281
- // #endregion AbortController
282
130
 
283
- // #region fetch
284
- interface RequestInit extends _RequestInit {}
131
+ interface ReadWriteStream extends ReadableStream, WritableStream {}
285
132
 
286
- function fetch(
287
- input: string | URL | Request,
288
- init?: RequestInit,
289
- ): Promise<Response>;
133
+ interface RefCounted {
134
+ ref(): this;
135
+ unref(): this;
136
+ }
290
137
 
291
- interface Request extends _Request {}
292
- var Request: typeof globalThis extends {
293
- onmessage: any;
294
- Request: infer T;
295
- } ? T
296
- : typeof import("undici-types").Request;
138
+ interface Dict<T> {
139
+ [key: string]: T | undefined;
140
+ }
297
141
 
298
- interface ResponseInit extends _ResponseInit {}
142
+ interface ReadOnlyDict<T> {
143
+ readonly [key: string]: T | undefined;
144
+ }
299
145
 
300
- interface Response extends _Response {}
301
- var Response: typeof globalThis extends {
302
- onmessage: any;
303
- Response: infer T;
304
- } ? T
305
- : typeof import("undici-types").Response;
146
+ interface GCFunction {
147
+ (minor?: boolean): void;
148
+ (options: NodeJS.GCOptions & { execution: "async" }): Promise<void>;
149
+ (options: NodeJS.GCOptions): void;
150
+ }
306
151
 
307
- interface FormData extends _FormData {}
308
- var FormData: typeof globalThis extends {
309
- onmessage: any;
310
- FormData: infer T;
311
- } ? T
312
- : typeof import("undici-types").FormData;
152
+ interface GCOptions {
153
+ execution?: "sync" | "async" | undefined;
154
+ type?: "major" | "minor" | undefined;
155
+ }
313
156
 
314
- interface Headers extends _Headers {}
315
- var Headers: typeof globalThis extends {
316
- onmessage: any;
317
- Headers: infer T;
318
- } ? T
319
- : typeof import("undici-types").Headers;
157
+ /** An iterable iterator returned by the Node.js API. */
158
+ // Default TReturn/TNext in v18 is `any`, for compatibility with the previously-used IterableIterator.
159
+ interface Iterator<T, TReturn = any, TNext = any> extends IteratorObject<T, TReturn, TNext> {
160
+ [Symbol.iterator](): NodeJS.Iterator<T, TReturn, TNext>;
161
+ }
320
162
 
321
- interface MessageEvent extends _MessageEvent {}
322
- var MessageEvent: typeof globalThis extends {
323
- onmessage: any;
324
- MessageEvent: infer T;
325
- } ? T
326
- : typeof import("undici-types").MessageEvent;
327
- // #endregion fetch
163
+ /** An async iterable iterator returned by the Node.js API. */
164
+ // Default TReturn/TNext in v18 is `any`, for compatibility with the previously-used AsyncIterableIterator.
165
+ interface AsyncIterator<T, TReturn = any, TNext = any> extends AsyncIteratorObject<T, TReturn, TNext> {
166
+ [Symbol.asyncIterator](): NodeJS.AsyncIterator<T, TReturn, TNext>;
167
+ }
328
168
  }
node v18.19/index.d.ts CHANGED
@@ -36,6 +36,10 @@
36
36
 
37
37
  // Definitions for Node.js modules that are not specific to any version of TypeScript:
38
38
  /// <reference path="globals.d.ts" />
39
+ /// <reference path="web-globals/abortcontroller.d.ts" />
40
+ /// <reference path="web-globals/domexception.d.ts" />
41
+ /// <reference path="web-globals/events.d.ts" />
42
+ /// <reference path="web-globals/fetch.d.ts" />
39
43
  /// <reference path="assert.d.ts" />
40
44
  /// <reference path="assert/strict.d.ts" />
41
45
  /// <reference path="async_hooks.d.ts" />
@@ -51,7 +55,6 @@
51
55
  /// <reference path="dns/promises.d.ts" />
52
56
  /// <reference path="dns/promises.d.ts" />
53
57
  /// <reference path="domain.d.ts" />
54
- /// <reference path="dom-events.d.ts" />
55
58
  /// <reference path="events.d.ts" />
56
59
  /// <reference path="fs.d.ts" />
57
60
  /// <reference path="fs/promises.d.ts" />
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.19.122",
3
+ "version": "18.19.124",
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": "aa0fbc187c55c67fe52a732b3e4c2dc8c88a7d12eac33b3d9c6b750f09b09a93",
143
+ "typesPublisherContentHash": "cfacae7427c3c3875e0bb6273f23337b1c1ad32a1d52bf325995af48a2626624",
144
144
  "typeScriptVersion": "5.2"
145
145
  }
@@ -36,6 +36,10 @@
36
36
 
37
37
  // Definitions for Node.js modules that are not specific to any version of TypeScript:
38
38
  /// <reference path="../globals.d.ts" />
39
+ /// <reference path="../web-globals/abortcontroller.d.ts" />
40
+ /// <reference path="../web-globals/domexception.d.ts" />
41
+ /// <reference path="../web-globals/events.d.ts" />
42
+ /// <reference path="../web-globals/fetch.d.ts" />
39
43
  /// <reference path="../assert.d.ts" />
40
44
  /// <reference path="../assert/strict.d.ts" />
41
45
  /// <reference path="../async_hooks.d.ts" />
@@ -51,7 +55,6 @@
51
55
  /// <reference path="../dns/promises.d.ts" />
52
56
  /// <reference path="../dns/promises.d.ts" />
53
57
  /// <reference path="../domain.d.ts" />
54
- /// <reference path="../dom-events.d.ts" />
55
58
  /// <reference path="../events.d.ts" />
56
59
  /// <reference path="../fs.d.ts" />
57
60
  /// <reference path="../fs/promises.d.ts" />
@@ -0,0 +1,34 @@
1
+ export {};
2
+
3
+ type _AbortController = typeof globalThis extends { onmessage: any } ? {} : AbortController;
4
+ interface AbortController {
5
+ readonly signal: AbortSignal;
6
+ abort(reason?: any): void;
7
+ }
8
+
9
+ type _AbortSignal = typeof globalThis extends { onmessage: any } ? {} : AbortSignal;
10
+ interface AbortSignal extends EventTarget {
11
+ readonly aborted: boolean;
12
+ onabort: ((this: AbortSignal, ev: Event) => any) | null;
13
+ readonly reason: any;
14
+ throwIfAborted(): void;
15
+ }
16
+
17
+ declare global {
18
+ interface AbortController extends _AbortController {}
19
+ var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
20
+ : {
21
+ prototype: AbortController;
22
+ new(): AbortController;
23
+ };
24
+
25
+ interface AbortSignal extends _AbortSignal {}
26
+ var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T
27
+ : {
28
+ prototype: AbortSignal;
29
+ new(): AbortSignal;
30
+ abort(reason?: any): AbortSignal;
31
+ any(signals: AbortSignal[]): AbortSignal;
32
+ timeout(milliseconds: number): AbortSignal;
33
+ };
34
+ }
@@ -0,0 +1,68 @@
1
+ export {};
2
+
3
+ type _DOMException = typeof globalThis extends { onmessage: any } ? {} : DOMException;
4
+ interface DOMException extends Error {
5
+ readonly code: number;
6
+ readonly message: string;
7
+ readonly name: string;
8
+ readonly INDEX_SIZE_ERR: 1;
9
+ readonly DOMSTRING_SIZE_ERR: 2;
10
+ readonly HIERARCHY_REQUEST_ERR: 3;
11
+ readonly WRONG_DOCUMENT_ERR: 4;
12
+ readonly INVALID_CHARACTER_ERR: 5;
13
+ readonly NO_DATA_ALLOWED_ERR: 6;
14
+ readonly NO_MODIFICATION_ALLOWED_ERR: 7;
15
+ readonly NOT_FOUND_ERR: 8;
16
+ readonly NOT_SUPPORTED_ERR: 9;
17
+ readonly INUSE_ATTRIBUTE_ERR: 10;
18
+ readonly INVALID_STATE_ERR: 11;
19
+ readonly SYNTAX_ERR: 12;
20
+ readonly INVALID_MODIFICATION_ERR: 13;
21
+ readonly NAMESPACE_ERR: 14;
22
+ readonly INVALID_ACCESS_ERR: 15;
23
+ readonly VALIDATION_ERR: 16;
24
+ readonly TYPE_MISMATCH_ERR: 17;
25
+ readonly SECURITY_ERR: 18;
26
+ readonly NETWORK_ERR: 19;
27
+ readonly ABORT_ERR: 20;
28
+ readonly URL_MISMATCH_ERR: 21;
29
+ readonly QUOTA_EXCEEDED_ERR: 22;
30
+ readonly TIMEOUT_ERR: 23;
31
+ readonly INVALID_NODE_TYPE_ERR: 24;
32
+ readonly DATA_CLONE_ERR: 25;
33
+ }
34
+
35
+ declare global {
36
+ interface DOMException extends _DOMException {}
37
+ var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
38
+ : {
39
+ prototype: DOMException;
40
+ new(message?: string, name?: string): DOMException;
41
+ new(message?: string, options?: { name?: string; cause?: unknown }): DOMException;
42
+ readonly INDEX_SIZE_ERR: 1;
43
+ readonly DOMSTRING_SIZE_ERR: 2;
44
+ readonly HIERARCHY_REQUEST_ERR: 3;
45
+ readonly WRONG_DOCUMENT_ERR: 4;
46
+ readonly INVALID_CHARACTER_ERR: 5;
47
+ readonly NO_DATA_ALLOWED_ERR: 6;
48
+ readonly NO_MODIFICATION_ALLOWED_ERR: 7;
49
+ readonly NOT_FOUND_ERR: 8;
50
+ readonly NOT_SUPPORTED_ERR: 9;
51
+ readonly INUSE_ATTRIBUTE_ERR: 10;
52
+ readonly INVALID_STATE_ERR: 11;
53
+ readonly SYNTAX_ERR: 12;
54
+ readonly INVALID_MODIFICATION_ERR: 13;
55
+ readonly NAMESPACE_ERR: 14;
56
+ readonly INVALID_ACCESS_ERR: 15;
57
+ readonly VALIDATION_ERR: 16;
58
+ readonly TYPE_MISMATCH_ERR: 17;
59
+ readonly SECURITY_ERR: 18;
60
+ readonly NETWORK_ERR: 19;
61
+ readonly ABORT_ERR: 20;
62
+ readonly URL_MISMATCH_ERR: 21;
63
+ readonly QUOTA_EXCEEDED_ERR: 22;
64
+ readonly TIMEOUT_ERR: 23;
65
+ readonly INVALID_NODE_TYPE_ERR: 24;
66
+ readonly DATA_CLONE_ERR: 25;
67
+ };
68
+ }
@@ -1,44 +1,31 @@
1
- // Make this a module
2
1
  export {};
3
2
 
4
- // Conditional type aliases, which are later merged into the global scope.
5
- // Will either be empty if the relevant web library is already present, or the @types/node definition otherwise.
3
+ interface AddEventListenerOptions extends EventListenerOptions {
4
+ once?: boolean;
5
+ passive?: boolean;
6
+ signal?: AbortSignal;
7
+ }
6
8
 
7
- type __Event = typeof globalThis extends { onmessage: any } ? {} : Event;
9
+ type _Event = typeof globalThis extends { onmessage: any } ? {} : Event;
8
10
  interface Event {
9
11
  readonly bubbles: boolean;
10
12
  cancelBubble: boolean;
11
13
  readonly cancelable: boolean;
12
14
  readonly composed: boolean;
13
- composedPath(): [EventTarget?];
14
15
  readonly currentTarget: EventTarget | null;
15
16
  readonly defaultPrevented: boolean;
16
17
  readonly eventPhase: 0 | 2;
17
- initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
18
18
  readonly isTrusted: boolean;
19
- preventDefault(): void;
20
- readonly returnValue: boolean;
19
+ returnValue: boolean;
21
20
  readonly srcElement: EventTarget | null;
22
- stopImmediatePropagation(): void;
23
- stopPropagation(): void;
24
21
  readonly target: EventTarget | null;
25
22
  readonly timeStamp: number;
26
23
  readonly type: string;
27
- }
28
-
29
- type __EventTarget = typeof globalThis extends { onmessage: any } ? {} : EventTarget;
30
- interface EventTarget {
31
- addEventListener(
32
- type: string,
33
- listener: EventListener | EventListenerObject,
34
- options?: AddEventListenerOptions | boolean,
35
- ): void;
36
- dispatchEvent(event: Event): boolean;
37
- removeEventListener(
38
- type: string,
39
- listener: EventListener | EventListenerObject,
40
- options?: EventListenerOptions | boolean,
41
- ): void;
24
+ composedPath(): [EventTarget?];
25
+ initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
26
+ preventDefault(): void;
27
+ stopImmediatePropagation(): void;
28
+ stopPropagation(): void;
42
29
  }
43
30
 
44
31
  interface EventInit {
@@ -47,16 +34,6 @@ interface EventInit {
47
34
  composed?: boolean;
48
35
  }
49
36
 
50
- interface EventListenerOptions {
51
- capture?: boolean;
52
- }
53
-
54
- interface AddEventListenerOptions extends EventListenerOptions {
55
- once?: boolean;
56
- passive?: boolean;
57
- signal?: AbortSignal;
58
- }
59
-
60
37
  interface EventListener {
61
38
  (evt: Event): void;
62
39
  }
@@ -65,16 +42,34 @@ interface EventListenerObject {
65
42
  handleEvent(object: Event): void;
66
43
  }
67
44
 
68
- // Merge conditional interfaces into global scope, and conditionally declare global constructors.
45
+ interface EventListenerOptions {
46
+ capture?: boolean;
47
+ }
48
+
49
+ type _EventTarget = typeof globalThis extends { onmessage: any } ? {} : EventTarget;
50
+ interface EventTarget {
51
+ addEventListener(
52
+ type: string,
53
+ listener: EventListener | EventListenerObject,
54
+ options?: AddEventListenerOptions | boolean,
55
+ ): void;
56
+ dispatchEvent(event: Event): boolean;
57
+ removeEventListener(
58
+ type: string,
59
+ listener: EventListener | EventListenerObject,
60
+ options?: EventListenerOptions | boolean,
61
+ ): void;
62
+ }
63
+
69
64
  declare global {
70
- interface Event extends __Event {}
65
+ interface Event extends _Event {}
71
66
  var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T
72
67
  : {
73
68
  prototype: Event;
74
69
  new(type: string, eventInitDict?: EventInit): Event;
75
70
  };
76
71
 
77
- interface EventTarget extends __EventTarget {}
72
+ interface EventTarget extends _EventTarget {}
78
73
  var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
79
74
  : {
80
75
  prototype: EventTarget;
@@ -0,0 +1,38 @@
1
+ export {};
2
+
3
+ import * as undici from "undici-types";
4
+
5
+ type _FormData = typeof globalThis extends { onmessage: any } ? {} : undici.FormData;
6
+ type _Headers = typeof globalThis extends { onmessage: any } ? {} : undici.Headers;
7
+ type _MessageEvent = typeof globalThis extends { onmessage: any } ? {} : undici.MessageEvent;
8
+ type _Request = typeof globalThis extends { onmessage: any } ? {} : undici.Request;
9
+ type _RequestInit = typeof globalThis extends { onmessage: any } ? {} : undici.RequestInit;
10
+ type _Response = typeof globalThis extends { onmessage: any } ? {} : undici.Response;
11
+ type _ResponseInit = typeof globalThis extends { onmessage: any } ? {} : undici.ResponseInit;
12
+
13
+ declare global {
14
+ function fetch(
15
+ input: string | URL | Request,
16
+ init?: RequestInit,
17
+ ): Promise<Response>;
18
+
19
+ interface FormData extends _FormData {}
20
+ var FormData: typeof globalThis extends { onmessage: any; FormData: infer T } ? T : typeof undici.FormData;
21
+
22
+ interface Headers extends _Headers {}
23
+ var Headers: typeof globalThis extends { onmessage: any; Headers: infer T } ? T : typeof undici.Headers;
24
+
25
+ interface MessageEvent extends _MessageEvent {}
26
+ var MessageEvent: typeof globalThis extends { onmessage: any; MessageEvent: infer T } ? T
27
+ : typeof undici.MessageEvent;
28
+
29
+ interface Request extends _Request {}
30
+ var Request: typeof globalThis extends { onmessage: any; Request: infer T } ? T : typeof undici.Request;
31
+
32
+ interface RequestInit extends _RequestInit {}
33
+
34
+ interface Response extends _Response {}
35
+ var Response: typeof globalThis extends { onmessage: any; Response: infer T } ? T : typeof undici.Response;
36
+
37
+ interface ResponseInit extends _ResponseInit {}
38
+ }