@types/node 20.17.37 → 20.17.38

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.17/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: Mon, 05 May 2025 21:33:58 GMT
11
+ * Last updated: Mon, 05 May 2025 23:02:37 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
@@ -17,15 +17,8 @@ type _ResponseInit = typeof globalThis extends { onmessage: any } ? {}
17
17
  // #region DOMException
18
18
  type _DOMException = typeof globalThis extends { onmessage: any } ? {} : NodeDOMException;
19
19
  interface NodeDOMException extends Error {
20
- /**
21
- * @deprecated
22
- *
23
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
24
- */
25
20
  readonly code: number;
26
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
27
21
  readonly message: string;
28
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
29
22
  readonly name: string;
30
23
  readonly INDEX_SIZE_ERR: 1;
31
24
  readonly DOMSTRING_SIZE_ERR: 2;
@@ -85,223 +78,104 @@ interface NodeDOMExceptionConstructor {
85
78
  // #endregion DOMException
86
79
 
87
80
  declare global {
88
- // Declare "static" methods in Error
89
- interface ErrorConstructor {
90
- /** Create .stack property on a target object */
91
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
92
-
93
- /**
94
- * Optional override for formatting stack traces
95
- *
96
- * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
97
- */
98
- prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
99
-
100
- stackTraceLimit: number;
101
- }
102
-
103
- /*-----------------------------------------------*
104
- * *
105
- * GLOBAL *
106
- * *
107
- ------------------------------------------------*/
108
-
109
81
  var global: typeof globalThis;
110
82
 
111
83
  var process: NodeJS.Process;
112
84
  var console: Console;
113
85
 
114
- interface GCFunction {
115
- (options: {
116
- execution?: "sync";
117
- type?: "major" | "minor";
118
- }): void;
119
- (options: {
120
- execution: "async";
121
- type?: "major" | "minor";
122
- }): Promise<void>;
123
- (options?: boolean): void;
124
- }
125
-
126
- /**
127
- * Only available if `--expose-gc` is passed to the process.
128
- */
129
- var gc: undefined | GCFunction;
130
-
131
- // #region borrowed
132
- // from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
133
- /** A controller object that allows you to abort one or more DOM requests as and when desired. */
134
- interface AbortController {
86
+ interface ErrorConstructor {
135
87
  /**
136
- * Returns the AbortSignal object associated with this object.
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
+ * ```
137
131
  */
138
-
139
- readonly signal: AbortSignal;
132
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
140
133
  /**
141
- * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
134
+ * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
142
135
  */
143
- abort(reason?: any): void;
144
- }
145
-
146
- /** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
147
- interface AbortSignal extends EventTarget {
136
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
148
137
  /**
149
- * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
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.
150
147
  */
151
- readonly aborted: boolean;
152
- readonly reason: any;
153
- onabort: null | ((this: AbortSignal, event: Event) => any);
154
- throwIfAborted(): void;
148
+ stackTraceLimit: number;
155
149
  }
156
150
 
157
- var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
158
- : {
159
- prototype: AbortController;
160
- new(): AbortController;
161
- };
162
-
163
- var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T
164
- : {
165
- prototype: AbortSignal;
166
- new(): AbortSignal;
167
- abort(reason?: any): AbortSignal;
168
- timeout(milliseconds: number): AbortSignal;
169
- any(signals: AbortSignal[]): AbortSignal;
170
- };
171
- // #endregion borrowed
172
-
173
- /**
174
- * @since v17.0.0
175
- *
176
- * Creates a deep clone of an object.
177
- */
178
- function structuredClone<T>(
179
- value: T,
180
- transfer?: { transfer: ReadonlyArray<import("worker_threads").TransferListItem> },
181
- ): T;
182
-
183
- // #region DOMException
184
151
  /**
185
- * @since v17.0.0
186
- * An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API.
187
- *
188
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
152
+ * Enable this API with the `--expose-gc` CLI flag.
189
153
  */
190
- interface DOMException extends _DOMException {}
154
+ var gc: NodeJS.GCFunction | undefined;
191
155
 
192
- /**
193
- * @since v17.0.0
194
- *
195
- * The WHATWG `DOMException` class. See [DOMException](https://developer.mozilla.org/docs/Web/API/DOMException) for more details.
196
- */
197
- var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
198
- : NodeDOMExceptionConstructor;
199
- // #endregion DOMException
200
-
201
- /*----------------------------------------------*
202
- * *
203
- * GLOBAL INTERFACES *
204
- * *
205
- *-----------------------------------------------*/
206
156
  namespace NodeJS {
207
157
  interface CallSite {
208
- /**
209
- * Value of "this"
210
- */
211
- getThis(): unknown;
212
-
213
- /**
214
- * Type of "this" as a string.
215
- * This is the name of the function stored in the constructor field of
216
- * "this", if available. Otherwise the object's [[Class]] internal
217
- * property.
218
- */
219
- getTypeName(): string | null;
220
-
221
- /**
222
- * Current function
223
- */
158
+ getColumnNumber(): number | null;
159
+ getEnclosingColumnNumber(): number | null;
160
+ getEnclosingLineNumber(): number | null;
161
+ getEvalOrigin(): string | undefined;
162
+ getFileName(): string | null;
224
163
  getFunction(): Function | undefined;
225
-
226
- /**
227
- * Name of the current function, typically its name property.
228
- * If a name property is not available an attempt will be made to try
229
- * to infer a name from the function's context.
230
- */
231
164
  getFunctionName(): string | null;
232
-
233
- /**
234
- * Name of the property [of "this" or one of its prototypes] that holds
235
- * the current function
236
- */
237
- getMethodName(): string | null;
238
-
239
- /**
240
- * Name of the script [if this function was defined in a script]
241
- */
242
- getFileName(): string | undefined;
243
-
244
- /**
245
- * Current line number [if this function was defined in a script]
246
- */
247
165
  getLineNumber(): number | null;
248
-
249
- /**
250
- * Current column number [if this function was defined in a script]
251
- */
252
- getColumnNumber(): number | null;
253
-
254
- /**
255
- * A call site object representing the location where eval was called
256
- * [if this function was created using a call to eval]
257
- */
258
- getEvalOrigin(): string | undefined;
259
-
260
- /**
261
- * Is this a toplevel invocation, that is, is "this" the global object?
262
- */
263
- isToplevel(): boolean;
264
-
265
- /**
266
- * Does this call take place in code defined by a call to eval?
267
- */
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;
268
175
  isEval(): boolean;
269
-
270
- /**
271
- * Is this call in native V8 code?
272
- */
273
176
  isNative(): boolean;
274
-
275
- /**
276
- * Is this a constructor call?
277
- */
278
- isConstructor(): boolean;
279
-
280
- /**
281
- * is this an async call (i.e. await, Promise.all(), or Promise.any())?
282
- */
283
- isAsync(): boolean;
284
-
285
- /**
286
- * is this an async call to Promise.all()?
287
- */
288
177
  isPromiseAll(): boolean;
289
-
290
- /**
291
- * returns the index of the promise element that was followed in
292
- * Promise.all() or Promise.any() for async stack traces, or null
293
- * if the CallSite is not an async
294
- */
295
- getPromiseIndex(): number | null;
296
-
297
- getScriptNameOrSourceURL(): string;
298
- getScriptHash(): string;
299
-
300
- getEnclosingColumnNumber(): number;
301
- getEnclosingLineNumber(): number;
302
- getPosition(): number;
303
-
304
- toString(): string;
178
+ isToplevel(): boolean;
305
179
  }
306
180
 
307
181
  interface ErrnoException extends Error {
@@ -349,6 +223,19 @@ declare global {
349
223
  readonly [key: string]: T | undefined;
350
224
  }
351
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
+ flavor?: "regular" | "last-resort" | undefined;
235
+ type?: "major-snapshot" | "major" | "minor" | undefined;
236
+ filename?: string | undefined;
237
+ }
238
+
352
239
  /** An iterable iterator returned by the Node.js API. */
353
240
  // Default TReturn/TNext in v20 is `any`, for compatibility with the previously-used IterableIterator.
354
241
  interface Iterator<T, TReturn = any, TNext = any> extends IteratorObject<T, TReturn, TNext> {
@@ -362,6 +249,45 @@ declare global {
362
249
  }
363
250
  }
364
251
 
252
+ // Global DOM types
253
+
254
+ function structuredClone<T>(
255
+ value: T,
256
+ transfer?: { transfer: ReadonlyArray<import("worker_threads").TransferListItem> },
257
+ ): T;
258
+
259
+ interface DOMException extends _DOMException {}
260
+ var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
261
+ : NodeDOMExceptionConstructor;
262
+
263
+ // #region AbortController
264
+ interface AbortController {
265
+ readonly signal: AbortSignal;
266
+ abort(reason?: any): void;
267
+ }
268
+ var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
269
+ : {
270
+ prototype: AbortController;
271
+ new(): AbortController;
272
+ };
273
+
274
+ interface AbortSignal extends EventTarget {
275
+ readonly aborted: boolean;
276
+ onabort: ((this: AbortSignal, ev: Event) => any) | null;
277
+ readonly reason: any;
278
+ throwIfAborted(): void;
279
+ }
280
+ var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T
281
+ : {
282
+ prototype: AbortSignal;
283
+ new(): AbortSignal;
284
+ abort(reason?: any): AbortSignal;
285
+ any(signals: AbortSignal[]): AbortSignal;
286
+ timeout(milliseconds: number): AbortSignal;
287
+ };
288
+ // #endregion AbortController
289
+
290
+ // #region fetch
365
291
  interface RequestInit extends _RequestInit {}
366
292
 
367
293
  function fetch(
@@ -400,12 +326,11 @@ declare global {
400
326
  : typeof import("undici-types").Headers;
401
327
 
402
328
  interface MessageEvent extends _MessageEvent {}
403
- /**
404
- * @since v15.0.0
405
- */
406
329
  var MessageEvent: typeof globalThis extends {
407
330
  onmessage: any;
408
331
  MessageEvent: infer T;
409
332
  } ? T
410
333
  : typeof import("undici-types").MessageEvent;
334
+
335
+ // #endregion fetch
411
336
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "20.17.37",
3
+ "version": "20.17.38",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -215,6 +215,6 @@
215
215
  "undici-types": "~6.19.2"
216
216
  },
217
217
  "peerDependencies": {},
218
- "typesPublisherContentHash": "d15f46c58fd07f19a0d5cd2f3cf6e584d40c9a6225811cf7f56fc9058a0e4999",
218
+ "typesPublisherContentHash": "6f979f756941527fd674ce3513f5ea0236e15ffc9cd36b65ed1be3f1aabfdcfa",
219
219
  "typeScriptVersion": "5.1"
220
220
  }