@types/node 16.0.1 → 16.3.1
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/README.md +1 -1
- node/async_hooks.d.ts +2 -4
- node/child_process.d.ts +10 -10
- node/crypto.d.ts +8 -6
- node/fs/promises.d.ts +46 -103
- node/fs.d.ts +75 -60
- node/http.d.ts +0 -7
- node/index.d.ts +1 -1
- node/os.d.ts +3 -1
- node/package.json +2 -2
- node/process.d.ts +24 -25
- node/timers.d.ts +9 -0
- node/ts3.6/base.d.ts +0 -1
- node/url.d.ts +7 -0
- node/util.d.ts +62 -0
- node/util/types.d.ts +0 -57
node/process.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare module 'process' {
|
|
2
2
|
import * as tty from 'tty';
|
|
3
|
+
import { Worker } from 'worker_threads';
|
|
3
4
|
|
|
4
5
|
global {
|
|
5
6
|
var process: NodeJS.Process;
|
|
@@ -78,22 +79,26 @@ declare module 'process' {
|
|
|
78
79
|
type BeforeExitListener = (code: number) => void;
|
|
79
80
|
type DisconnectListener = () => void;
|
|
80
81
|
type ExitListener = (code: number) => void;
|
|
81
|
-
type RejectionHandledListener = (promise: Promise<
|
|
82
|
+
type RejectionHandledListener = (promise: Promise<unknown>) => void;
|
|
82
83
|
type UncaughtExceptionListener = (error: Error) => void;
|
|
83
|
-
type UnhandledRejectionListener = (reason: {} | null | undefined, promise: Promise<
|
|
84
|
+
type UnhandledRejectionListener = (reason: {} | null | undefined, promise: Promise<unknown>) => void;
|
|
84
85
|
type WarningListener = (warning: Error) => void;
|
|
85
|
-
type MessageListener = (message:
|
|
86
|
+
type MessageListener = (message: unknown, sendHandle: unknown) => void;
|
|
86
87
|
type SignalsListener = (signal: Signals) => void;
|
|
87
|
-
type
|
|
88
|
-
type
|
|
89
|
-
type MultipleResolveListener = (type: MultipleResolveType, promise: Promise<any>, value: any) => void;
|
|
88
|
+
type MultipleResolveListener = (type: MultipleResolveType, promise: Promise<unknown>, value: unknown) => void;
|
|
89
|
+
type WorkerListener = (worker: Worker) => void;
|
|
90
90
|
|
|
91
91
|
interface Socket extends ReadWriteStream {
|
|
92
92
|
isTTY?: true | undefined;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
// Alias for compatibility
|
|
96
|
-
interface ProcessEnv extends Dict<string> {
|
|
96
|
+
interface ProcessEnv extends Dict<string> {
|
|
97
|
+
/**
|
|
98
|
+
* Can be used to change the default timezone at runtime
|
|
99
|
+
*/
|
|
100
|
+
TZ?: string;
|
|
101
|
+
}
|
|
97
102
|
|
|
98
103
|
interface HRTime {
|
|
99
104
|
(time?: [number, number]): [number, number];
|
|
@@ -363,23 +368,21 @@ declare module 'process' {
|
|
|
363
368
|
addListener(event: "warning", listener: WarningListener): this;
|
|
364
369
|
addListener(event: "message", listener: MessageListener): this;
|
|
365
370
|
addListener(event: Signals, listener: SignalsListener): this;
|
|
366
|
-
addListener(event: "newListener", listener: NewListenerListener): this;
|
|
367
|
-
addListener(event: "removeListener", listener: RemoveListenerListener): this;
|
|
368
371
|
addListener(event: "multipleResolves", listener: MultipleResolveListener): this;
|
|
372
|
+
addListener(event: "worker", listener: WorkerListener): this;
|
|
369
373
|
|
|
370
374
|
emit(event: "beforeExit", code: number): boolean;
|
|
371
375
|
emit(event: "disconnect"): boolean;
|
|
372
376
|
emit(event: "exit", code: number): boolean;
|
|
373
|
-
emit(event: "rejectionHandled", promise: Promise<
|
|
377
|
+
emit(event: "rejectionHandled", promise: Promise<unknown>): boolean;
|
|
374
378
|
emit(event: "uncaughtException", error: Error): boolean;
|
|
375
379
|
emit(event: "uncaughtExceptionMonitor", error: Error): boolean;
|
|
376
|
-
emit(event: "unhandledRejection", reason:
|
|
380
|
+
emit(event: "unhandledRejection", reason: unknown, promise: Promise<unknown>): boolean;
|
|
377
381
|
emit(event: "warning", warning: Error): boolean;
|
|
378
|
-
emit(event: "message", message:
|
|
382
|
+
emit(event: "message", message: unknown, sendHandle: unknown): this;
|
|
379
383
|
emit(event: Signals, signal: Signals): boolean;
|
|
380
|
-
emit(event: "
|
|
381
|
-
emit(event: "
|
|
382
|
-
emit(event: "multipleResolves", listener: MultipleResolveListener): this;
|
|
384
|
+
emit(event: "multipleResolves", type: MultipleResolveType, promise: Promise<unknown>, value: unknown): this;
|
|
385
|
+
emit(event: "worker", listener: WorkerListener): this;
|
|
383
386
|
|
|
384
387
|
on(event: "beforeExit", listener: BeforeExitListener): this;
|
|
385
388
|
on(event: "disconnect", listener: DisconnectListener): this;
|
|
@@ -391,9 +394,8 @@ declare module 'process' {
|
|
|
391
394
|
on(event: "warning", listener: WarningListener): this;
|
|
392
395
|
on(event: "message", listener: MessageListener): this;
|
|
393
396
|
on(event: Signals, listener: SignalsListener): this;
|
|
394
|
-
on(event: "newListener", listener: NewListenerListener): this;
|
|
395
|
-
on(event: "removeListener", listener: RemoveListenerListener): this;
|
|
396
397
|
on(event: "multipleResolves", listener: MultipleResolveListener): this;
|
|
398
|
+
on(event: "worker", listener: WorkerListener): this;
|
|
397
399
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
398
400
|
|
|
399
401
|
once(event: "beforeExit", listener: BeforeExitListener): this;
|
|
@@ -406,9 +408,9 @@ declare module 'process' {
|
|
|
406
408
|
once(event: "warning", listener: WarningListener): this;
|
|
407
409
|
once(event: "message", listener: MessageListener): this;
|
|
408
410
|
once(event: Signals, listener: SignalsListener): this;
|
|
409
|
-
once(event: "newListener", listener: NewListenerListener): this;
|
|
410
|
-
once(event: "removeListener", listener: RemoveListenerListener): this;
|
|
411
411
|
once(event: "multipleResolves", listener: MultipleResolveListener): this;
|
|
412
|
+
once(event: "worker", listener: WorkerListener): this;
|
|
413
|
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
412
414
|
|
|
413
415
|
prependListener(event: "beforeExit", listener: BeforeExitListener): this;
|
|
414
416
|
prependListener(event: "disconnect", listener: DisconnectListener): this;
|
|
@@ -420,9 +422,8 @@ declare module 'process' {
|
|
|
420
422
|
prependListener(event: "warning", listener: WarningListener): this;
|
|
421
423
|
prependListener(event: "message", listener: MessageListener): this;
|
|
422
424
|
prependListener(event: Signals, listener: SignalsListener): this;
|
|
423
|
-
prependListener(event: "newListener", listener: NewListenerListener): this;
|
|
424
|
-
prependListener(event: "removeListener", listener: RemoveListenerListener): this;
|
|
425
425
|
prependListener(event: "multipleResolves", listener: MultipleResolveListener): this;
|
|
426
|
+
prependListener(event: "worker", listener: WorkerListener): this;
|
|
426
427
|
|
|
427
428
|
prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this;
|
|
428
429
|
prependOnceListener(event: "disconnect", listener: DisconnectListener): this;
|
|
@@ -434,9 +435,8 @@ declare module 'process' {
|
|
|
434
435
|
prependOnceListener(event: "warning", listener: WarningListener): this;
|
|
435
436
|
prependOnceListener(event: "message", listener: MessageListener): this;
|
|
436
437
|
prependOnceListener(event: Signals, listener: SignalsListener): this;
|
|
437
|
-
prependOnceListener(event: "newListener", listener: NewListenerListener): this;
|
|
438
|
-
prependOnceListener(event: "removeListener", listener: RemoveListenerListener): this;
|
|
439
438
|
prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this;
|
|
439
|
+
prependOnceListener(event: "worker", listener: WorkerListener): this;
|
|
440
440
|
|
|
441
441
|
listeners(event: "beforeExit"): BeforeExitListener[];
|
|
442
442
|
listeners(event: "disconnect"): DisconnectListener[];
|
|
@@ -448,9 +448,8 @@ declare module 'process' {
|
|
|
448
448
|
listeners(event: "warning"): WarningListener[];
|
|
449
449
|
listeners(event: "message"): MessageListener[];
|
|
450
450
|
listeners(event: Signals): SignalsListener[];
|
|
451
|
-
listeners(event: "newListener"): NewListenerListener[];
|
|
452
|
-
listeners(event: "removeListener"): RemoveListenerListener[];
|
|
453
451
|
listeners(event: "multipleResolves"): MultipleResolveListener[];
|
|
452
|
+
listeners(event: "worker"): WorkerListener[];
|
|
454
453
|
}
|
|
455
454
|
}
|
|
456
455
|
}
|
node/timers.d.ts
CHANGED
|
@@ -40,18 +40,27 @@ declare module 'timers' {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
function setTimeout<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
|
|
43
|
+
// util.promisify no rest args compability
|
|
44
|
+
// tslint:disable-next-line void-return
|
|
45
|
+
function setTimeout(callback: (args: void) => void): NodeJS.Timeout;
|
|
43
46
|
namespace setTimeout {
|
|
44
47
|
const __promisify__: typeof setTimeoutPromise;
|
|
45
48
|
}
|
|
46
49
|
function clearTimeout(timeoutId: NodeJS.Timeout): void;
|
|
47
50
|
|
|
48
51
|
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timer;
|
|
52
|
+
// util.promisify no rest args compability
|
|
53
|
+
// tslint:disable-next-line void-return
|
|
54
|
+
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timer;
|
|
49
55
|
namespace setInterval {
|
|
50
56
|
const __promisify__: typeof setIntervalPromise;
|
|
51
57
|
}
|
|
52
58
|
function clearInterval(intervalId: NodeJS.Timeout): void;
|
|
53
59
|
|
|
54
60
|
function setImmediate<TArgs extends any[]>(callback: (...args: TArgs) => void, ...args: TArgs): NodeJS.Immediate;
|
|
61
|
+
// util.promisify no rest args compability
|
|
62
|
+
// tslint:disable-next-line void-return
|
|
63
|
+
function setImmediate(callback: (args: void) => void): NodeJS.Immediate;
|
|
55
64
|
namespace setImmediate {
|
|
56
65
|
const __promisify__: typeof setImmediatePromise;
|
|
57
66
|
}
|
node/ts3.6/base.d.ts
CHANGED
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
/// <reference path="../tty.d.ts" />
|
|
56
56
|
/// <reference path="../url.d.ts" />
|
|
57
57
|
/// <reference path="../util.d.ts" />
|
|
58
|
-
/// <reference path="../util/types.d.ts" />
|
|
59
58
|
/// <reference path="../v8.d.ts" />
|
|
60
59
|
/// <reference path="../vm.d.ts" />
|
|
61
60
|
/// <reference path="../worker_threads.d.ts" />
|
node/url.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
declare module 'url' {
|
|
2
|
+
import { ClientRequestArgs } from 'http';
|
|
2
3
|
import { ParsedUrlQuery, ParsedUrlQueryInput } from 'querystring';
|
|
3
4
|
|
|
4
5
|
// Input to `url.format`
|
|
@@ -72,6 +73,12 @@ declare module 'url' {
|
|
|
72
73
|
*/
|
|
73
74
|
function pathToFileURL(url: string): URL;
|
|
74
75
|
|
|
76
|
+
/**
|
|
77
|
+
* This utility function converts a URL object into an ordinary options object as
|
|
78
|
+
* expected by the `http.request()` and `https.request()` APIs.
|
|
79
|
+
*/
|
|
80
|
+
function urlToHttpOptions(url: URL): ClientRequestArgs;
|
|
81
|
+
|
|
75
82
|
interface URLFormatOptions {
|
|
76
83
|
auth?: boolean | undefined;
|
|
77
84
|
fragment?: boolean | undefined;
|
node/util.d.ts
CHANGED
|
@@ -200,3 +200,65 @@ declare module 'util' {
|
|
|
200
200
|
declare module 'node:util' {
|
|
201
201
|
export * from 'util';
|
|
202
202
|
}
|
|
203
|
+
|
|
204
|
+
declare module 'util/types' {
|
|
205
|
+
import { KeyObject, webcrypto } from 'crypto';
|
|
206
|
+
|
|
207
|
+
function isAnyArrayBuffer(object: unknown): object is ArrayBufferLike;
|
|
208
|
+
function isArgumentsObject(object: unknown): object is IArguments;
|
|
209
|
+
function isArrayBuffer(object: unknown): object is ArrayBuffer;
|
|
210
|
+
function isArrayBufferView(object: unknown): object is NodeJS.ArrayBufferView;
|
|
211
|
+
function isAsyncFunction(object: unknown): boolean;
|
|
212
|
+
function isBigInt64Array(value: unknown): value is BigInt64Array;
|
|
213
|
+
function isBigUint64Array(value: unknown): value is BigUint64Array;
|
|
214
|
+
function isBooleanObject(object: unknown): object is Boolean;
|
|
215
|
+
function isBoxedPrimitive(object: unknown): object is String | Number | BigInt | Boolean | Symbol;
|
|
216
|
+
function isDataView(object: unknown): object is DataView;
|
|
217
|
+
function isDate(object: unknown): object is Date;
|
|
218
|
+
function isExternal(object: unknown): boolean;
|
|
219
|
+
function isFloat32Array(object: unknown): object is Float32Array;
|
|
220
|
+
function isFloat64Array(object: unknown): object is Float64Array;
|
|
221
|
+
function isGeneratorFunction(object: unknown): object is GeneratorFunction;
|
|
222
|
+
function isGeneratorObject(object: unknown): object is Generator;
|
|
223
|
+
function isInt8Array(object: unknown): object is Int8Array;
|
|
224
|
+
function isInt16Array(object: unknown): object is Int16Array;
|
|
225
|
+
function isInt32Array(object: unknown): object is Int32Array;
|
|
226
|
+
function isMap<T>(
|
|
227
|
+
object: T | {},
|
|
228
|
+
): object is T extends ReadonlyMap<any, any>
|
|
229
|
+
? unknown extends T
|
|
230
|
+
? never
|
|
231
|
+
: ReadonlyMap<any, any>
|
|
232
|
+
: Map<unknown, unknown>;
|
|
233
|
+
function isMapIterator(object: unknown): boolean;
|
|
234
|
+
function isModuleNamespaceObject(value: unknown): boolean;
|
|
235
|
+
function isNativeError(object: unknown): object is Error;
|
|
236
|
+
function isNumberObject(object: unknown): object is Number;
|
|
237
|
+
function isPromise(object: unknown): object is Promise<unknown>;
|
|
238
|
+
function isProxy(object: unknown): boolean;
|
|
239
|
+
function isRegExp(object: unknown): object is RegExp;
|
|
240
|
+
function isSet<T>(
|
|
241
|
+
object: T | {},
|
|
242
|
+
): object is T extends ReadonlySet<any>
|
|
243
|
+
? unknown extends T
|
|
244
|
+
? never
|
|
245
|
+
: ReadonlySet<any>
|
|
246
|
+
: Set<unknown>;
|
|
247
|
+
function isSetIterator(object: unknown): boolean;
|
|
248
|
+
function isSharedArrayBuffer(object: unknown): object is SharedArrayBuffer;
|
|
249
|
+
function isStringObject(object: unknown): object is String;
|
|
250
|
+
function isSymbolObject(object: unknown): object is Symbol;
|
|
251
|
+
function isTypedArray(object: unknown): object is NodeJS.TypedArray;
|
|
252
|
+
function isUint8Array(object: unknown): object is Uint8Array;
|
|
253
|
+
function isUint8ClampedArray(object: unknown): object is Uint8ClampedArray;
|
|
254
|
+
function isUint16Array(object: unknown): object is Uint16Array;
|
|
255
|
+
function isUint32Array(object: unknown): object is Uint32Array;
|
|
256
|
+
function isWeakMap(object: unknown): object is WeakMap<object, unknown>;
|
|
257
|
+
function isWeakSet(object: unknown): object is WeakSet<object>;
|
|
258
|
+
function isKeyObject(object: unknown): object is KeyObject;
|
|
259
|
+
function isCryptoKey(object: unknown): object is webcrypto.CryptoKey;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
declare module 'node:util/types' {
|
|
263
|
+
export * from 'util/types';
|
|
264
|
+
}
|
node/util/types.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
declare module 'util/types' {
|
|
2
|
-
function isAnyArrayBuffer(object: unknown): object is ArrayBufferLike;
|
|
3
|
-
function isArgumentsObject(object: unknown): object is IArguments;
|
|
4
|
-
function isArrayBuffer(object: unknown): object is ArrayBuffer;
|
|
5
|
-
function isArrayBufferView(object: unknown): object is NodeJS.ArrayBufferView;
|
|
6
|
-
function isAsyncFunction(object: unknown): boolean;
|
|
7
|
-
function isBigInt64Array(value: unknown): value is BigInt64Array;
|
|
8
|
-
function isBigUint64Array(value: unknown): value is BigUint64Array;
|
|
9
|
-
function isBooleanObject(object: unknown): object is Boolean;
|
|
10
|
-
function isBoxedPrimitive(object: unknown): object is String | Number | BigInt | Boolean | Symbol;
|
|
11
|
-
function isDataView(object: unknown): object is DataView;
|
|
12
|
-
function isDate(object: unknown): object is Date;
|
|
13
|
-
function isExternal(object: unknown): boolean;
|
|
14
|
-
function isFloat32Array(object: unknown): object is Float32Array;
|
|
15
|
-
function isFloat64Array(object: unknown): object is Float64Array;
|
|
16
|
-
function isGeneratorFunction(object: unknown): object is GeneratorFunction;
|
|
17
|
-
function isGeneratorObject(object: unknown): object is Generator;
|
|
18
|
-
function isInt8Array(object: unknown): object is Int8Array;
|
|
19
|
-
function isInt16Array(object: unknown): object is Int16Array;
|
|
20
|
-
function isInt32Array(object: unknown): object is Int32Array;
|
|
21
|
-
function isMap<T>(
|
|
22
|
-
object: T | {},
|
|
23
|
-
): object is T extends ReadonlyMap<any, any>
|
|
24
|
-
? unknown extends T
|
|
25
|
-
? never
|
|
26
|
-
: ReadonlyMap<any, any>
|
|
27
|
-
: Map<unknown, unknown>;
|
|
28
|
-
function isMapIterator(object: unknown): boolean;
|
|
29
|
-
function isModuleNamespaceObject(value: unknown): boolean;
|
|
30
|
-
function isNativeError(object: unknown): object is Error;
|
|
31
|
-
function isNumberObject(object: unknown): object is Number;
|
|
32
|
-
function isPromise(object: unknown): object is Promise<unknown>;
|
|
33
|
-
function isProxy(object: unknown): boolean;
|
|
34
|
-
function isRegExp(object: unknown): object is RegExp;
|
|
35
|
-
function isSet<T>(
|
|
36
|
-
object: T | {},
|
|
37
|
-
): object is T extends ReadonlySet<any>
|
|
38
|
-
? unknown extends T
|
|
39
|
-
? never
|
|
40
|
-
: ReadonlySet<any>
|
|
41
|
-
: Set<unknown>;
|
|
42
|
-
function isSetIterator(object: unknown): boolean;
|
|
43
|
-
function isSharedArrayBuffer(object: unknown): object is SharedArrayBuffer;
|
|
44
|
-
function isStringObject(object: unknown): object is String;
|
|
45
|
-
function isSymbolObject(object: unknown): object is Symbol;
|
|
46
|
-
function isTypedArray(object: unknown): object is NodeJS.TypedArray;
|
|
47
|
-
function isUint8Array(object: unknown): object is Uint8Array;
|
|
48
|
-
function isUint8ClampedArray(object: unknown): object is Uint8ClampedArray;
|
|
49
|
-
function isUint16Array(object: unknown): object is Uint16Array;
|
|
50
|
-
function isUint32Array(object: unknown): object is Uint32Array;
|
|
51
|
-
function isWeakMap(object: unknown): object is WeakMap<object, unknown>;
|
|
52
|
-
function isWeakSet(object: unknown): object is WeakSet<object>;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
declare module 'node:util/types' {
|
|
56
|
-
export * from 'util/types';
|
|
57
|
-
}
|