@types/node 20.17.37 → 20.17.39
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 +1 -1
- node v20.17/fs.d.ts +44 -0
- node v20.17/globals.d.ts +128 -203
- node v20.17/package.json +2 -2
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:
|
11
|
+
* Last updated: Tue, 06 May 2025 01:29:57 GMT
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
13
13
|
|
14
14
|
# Credits
|
node v20.17/fs.d.ts
CHANGED
@@ -2317,6 +2317,20 @@ declare module "fs" {
|
|
2317
2317
|
* @since v0.1.96
|
2318
2318
|
*/
|
2319
2319
|
export function fsyncSync(fd: number): void;
|
2320
|
+
export interface WriteOptions {
|
2321
|
+
/**
|
2322
|
+
* @default 0
|
2323
|
+
*/
|
2324
|
+
offset?: number | undefined;
|
2325
|
+
/**
|
2326
|
+
* @default `buffer.byteLength - offset`
|
2327
|
+
*/
|
2328
|
+
length?: number | undefined;
|
2329
|
+
/**
|
2330
|
+
* @default null
|
2331
|
+
*/
|
2332
|
+
position?: number | undefined | null;
|
2333
|
+
}
|
2320
2334
|
/**
|
2321
2335
|
* Write `buffer` to the file specified by `fd`.
|
2322
2336
|
*
|
@@ -2385,6 +2399,20 @@ declare module "fs" {
|
|
2385
2399
|
buffer: TBuffer,
|
2386
2400
|
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
|
2387
2401
|
): void;
|
2402
|
+
/**
|
2403
|
+
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
2404
|
+
* @param fd A file descriptor.
|
2405
|
+
* @param options An object with the following properties:
|
2406
|
+
* * `offset` The part of the buffer to be written. If not supplied, defaults to `0`.
|
2407
|
+
* * `length` The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
2408
|
+
* * `position` The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
2409
|
+
*/
|
2410
|
+
export function write<TBuffer extends NodeJS.ArrayBufferView>(
|
2411
|
+
fd: number,
|
2412
|
+
buffer: TBuffer,
|
2413
|
+
options: WriteOptions,
|
2414
|
+
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
|
2415
|
+
): void;
|
2388
2416
|
/**
|
2389
2417
|
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
2390
2418
|
* @param fd A file descriptor.
|
@@ -2439,6 +2467,22 @@ declare module "fs" {
|
|
2439
2467
|
bytesWritten: number;
|
2440
2468
|
buffer: TBuffer;
|
2441
2469
|
}>;
|
2470
|
+
/**
|
2471
|
+
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
2472
|
+
* @param fd A file descriptor.
|
2473
|
+
* @param options An object with the following properties:
|
2474
|
+
* * `offset` The part of the buffer to be written. If not supplied, defaults to `0`.
|
2475
|
+
* * `length` The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
2476
|
+
* * `position` The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
2477
|
+
*/
|
2478
|
+
function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
|
2479
|
+
fd: number,
|
2480
|
+
buffer?: TBuffer,
|
2481
|
+
options?: WriteOptions,
|
2482
|
+
): Promise<{
|
2483
|
+
bytesWritten: number;
|
2484
|
+
buffer: TBuffer;
|
2485
|
+
}>;
|
2442
2486
|
/**
|
2443
2487
|
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
2444
2488
|
* @param fd A file descriptor.
|
node v20.17/globals.d.ts
CHANGED
@@ -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
|
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
|
-
*
|
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
|
-
*
|
134
|
+
* @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
142
135
|
*/
|
143
|
-
|
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
|
-
*
|
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
|
-
|
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
|
-
*
|
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
|
-
|
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
|
-
|
210
|
-
|
211
|
-
|
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
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
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
|
}
|
node v20.17/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/node",
|
3
|
-
"version": "20.17.
|
3
|
+
"version": "20.17.39",
|
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": "
|
218
|
+
"typesPublisherContentHash": "bcdce78491797c3a749515111f81d98e03c1d71992399a07bb1c227071f6fff6",
|
219
219
|
"typeScriptVersion": "5.1"
|
220
220
|
}
|