@types/node 18.19.92 → 18.19.93

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: 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,197 +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
- /**
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)
189
- */
190
- interface DOMException extends _DOMException {}
191
-
192
151
  /**
193
- * @since v17.0.0
194
- *
195
- * The WHATWG `DOMException` class. See [DOMException](https://developer.mozilla.org/docs/Web/API/DOMException) for more details.
152
+ * Enable this API with the `--expose-gc` CLI flag.
196
153
  */
197
- var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
198
- : NodeDOMExceptionConstructor;
199
- // #endregion DOMException
154
+ var gc: NodeJS.GCFunction | undefined;
200
155
 
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;
177
+ isPromiseAll(): boolean;
178
+ isToplevel(): boolean;
279
179
  }
280
180
 
281
181
  interface ErrnoException extends Error {
@@ -323,6 +223,17 @@ declare global {
323
223
  readonly [key: string]: T | undefined;
324
224
  }
325
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
+
326
237
  /** An iterable iterator returned by the Node.js API. */
327
238
  // Default TReturn/TNext in v18 is `any`, for compatibility with the previously-used IterableIterator.
328
239
  interface Iterator<T, TReturn = any, TNext = any> extends IteratorObject<T, TReturn, TNext> {
@@ -336,6 +247,45 @@ declare global {
336
247
  }
337
248
  }
338
249
 
250
+ // Global DOM types
251
+
252
+ function structuredClone<T>(
253
+ value: T,
254
+ transfer?: { transfer: ReadonlyArray<import("worker_threads").TransferListItem> },
255
+ ): T;
256
+
257
+ interface DOMException extends _DOMException {}
258
+ var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
259
+ : NodeDOMExceptionConstructor;
260
+
261
+ // #region AbortController
262
+ interface AbortController {
263
+ readonly signal: AbortSignal;
264
+ abort(reason?: any): void;
265
+ }
266
+ var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
267
+ : {
268
+ prototype: AbortController;
269
+ new(): AbortController;
270
+ };
271
+
272
+ interface AbortSignal extends EventTarget {
273
+ readonly aborted: boolean;
274
+ onabort: ((this: AbortSignal, ev: Event) => any) | null;
275
+ readonly reason: any;
276
+ throwIfAborted(): void;
277
+ }
278
+ var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T
279
+ : {
280
+ prototype: AbortSignal;
281
+ new(): AbortSignal;
282
+ abort(reason?: any): AbortSignal;
283
+ any(signals: AbortSignal[]): AbortSignal;
284
+ timeout(milliseconds: number): AbortSignal;
285
+ };
286
+ // #endregion AbortController
287
+
288
+ // #region fetch
339
289
  interface RequestInit extends _RequestInit {}
340
290
 
341
291
  function fetch(
@@ -374,12 +324,10 @@ declare global {
374
324
  : typeof import("undici-types").Headers;
375
325
 
376
326
  interface MessageEvent extends _MessageEvent {}
377
- /**
378
- * @since v15.0.0
379
- */
380
327
  var MessageEvent: typeof globalThis extends {
381
328
  onmessage: any;
382
329
  MessageEvent: infer T;
383
330
  } ? T
384
331
  : typeof import("undici-types").MessageEvent;
332
+ // #endregion fetch
385
333
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.19.92",
3
+ "version": "18.19.93",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -220,6 +220,6 @@
220
220
  "undici-types": "~5.26.4"
221
221
  },
222
222
  "peerDependencies": {},
223
- "typesPublisherContentHash": "ac804d6fc76633acbe050d4cee6afb333118333c08548d5e6beb766a881cee8d",
223
+ "typesPublisherContentHash": "837c25fd51b2953454eefd586d4fa92a142c155c99655b74e76616e39d39c541",
224
224
  "typeScriptVersion": "5.1"
225
225
  }