@types/node 18.19.92 → 18.19.94
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 +1 -1
- node v18.19/fs.d.ts +44 -0
- node v18.19/globals.d.ts +126 -178
- node v18.19/package.json +2 -2
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:
|
|
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 v18.19/fs.d.ts
CHANGED
|
@@ -2337,6 +2337,20 @@ declare module "fs" {
|
|
|
2337
2337
|
* @since v0.1.96
|
|
2338
2338
|
*/
|
|
2339
2339
|
export function fsyncSync(fd: number): void;
|
|
2340
|
+
export interface WriteOptions {
|
|
2341
|
+
/**
|
|
2342
|
+
* @default 0
|
|
2343
|
+
*/
|
|
2344
|
+
offset?: number | undefined;
|
|
2345
|
+
/**
|
|
2346
|
+
* @default `buffer.byteLength - offset`
|
|
2347
|
+
*/
|
|
2348
|
+
length?: number | undefined;
|
|
2349
|
+
/**
|
|
2350
|
+
* @default null
|
|
2351
|
+
*/
|
|
2352
|
+
position?: number | undefined | null;
|
|
2353
|
+
}
|
|
2340
2354
|
/**
|
|
2341
2355
|
* Write `buffer` to the file specified by `fd`.
|
|
2342
2356
|
*
|
|
@@ -2402,6 +2416,20 @@ declare module "fs" {
|
|
|
2402
2416
|
buffer: TBuffer,
|
|
2403
2417
|
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
|
|
2404
2418
|
): void;
|
|
2419
|
+
/**
|
|
2420
|
+
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
|
2421
|
+
* @param fd A file descriptor.
|
|
2422
|
+
* @param options An object with the following properties:
|
|
2423
|
+
* * `offset` The part of the buffer to be written. If not supplied, defaults to `0`.
|
|
2424
|
+
* * `length` The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
|
2425
|
+
* * `position` The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
2426
|
+
*/
|
|
2427
|
+
export function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2428
|
+
fd: number,
|
|
2429
|
+
buffer: TBuffer,
|
|
2430
|
+
options: WriteOptions,
|
|
2431
|
+
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
|
|
2432
|
+
): void;
|
|
2405
2433
|
/**
|
|
2406
2434
|
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
|
2407
2435
|
* @param fd A file descriptor.
|
|
@@ -2456,6 +2484,22 @@ declare module "fs" {
|
|
|
2456
2484
|
bytesWritten: number;
|
|
2457
2485
|
buffer: TBuffer;
|
|
2458
2486
|
}>;
|
|
2487
|
+
/**
|
|
2488
|
+
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
|
2489
|
+
* @param fd A file descriptor.
|
|
2490
|
+
* @param options An object with the following properties:
|
|
2491
|
+
* * `offset` The part of the buffer to be written. If not supplied, defaults to `0`.
|
|
2492
|
+
* * `length` The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
|
2493
|
+
* * `position` The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
2494
|
+
*/
|
|
2495
|
+
function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2496
|
+
fd: number,
|
|
2497
|
+
buffer?: TBuffer,
|
|
2498
|
+
options?: WriteOptions,
|
|
2499
|
+
): Promise<{
|
|
2500
|
+
bytesWritten: number;
|
|
2501
|
+
buffer: TBuffer;
|
|
2502
|
+
}>;
|
|
2459
2503
|
/**
|
|
2460
2504
|
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
|
2461
2505
|
* @param fd A file descriptor.
|
node v18.19/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,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
|
|
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
|
-
/**
|
|
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
|
-
*
|
|
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
|
|
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
|
-
|
|
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;
|
|
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
|
}
|
node v18.19/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "18.19.
|
|
3
|
+
"version": "18.19.94",
|
|
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": "
|
|
223
|
+
"typesPublisherContentHash": "74aec6b27690890a4b2ea9418957876444a5954d5d42fcb5b206d0c886838b7c",
|
|
224
224
|
"typeScriptVersion": "5.1"
|
|
225
225
|
}
|