@types/node 15.3.1 → 15.9.0
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/buffer.d.ts +62 -0
- node/child_process.d.ts +12 -8
- node/crypto.d.ts +255 -6
- node/dgram.d.ts +2 -2
- node/events.d.ts +7 -0
- node/fs/promises.d.ts +35 -1
- node/fs.d.ts +34 -70
- node/globals.d.ts +4 -0
- node/http.d.ts +18 -9
- node/index.d.ts +1 -1
- node/net.d.ts +2 -2
- node/os.d.ts +1 -1
- node/package.json +4 -3
- node/perf_hooks.d.ts +60 -24
- node/process.d.ts +14 -2
- node/readline.d.ts +23 -2
- node/stream.d.ts +21 -13
- node/timers/promises.d.ts +10 -2
- node/timers.d.ts +3 -6
- node/tls.d.ts +14 -0
- node/util/types.d.ts +0 -4
- node/wasi.d.ts +3 -3
- node/worker_threads.d.ts +25 -7
node/readline.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare module 'readline' {
|
|
2
|
-
import EventEmitter
|
|
2
|
+
import { Abortable, EventEmitter } from 'events';
|
|
3
3
|
|
|
4
4
|
interface Key {
|
|
5
5
|
sequence?: string;
|
|
@@ -42,6 +42,7 @@ declare module 'readline' {
|
|
|
42
42
|
setPrompt(prompt: string): void;
|
|
43
43
|
prompt(preserveCursor?: boolean): void;
|
|
44
44
|
question(query: string, callback: (answer: string) => void): void;
|
|
45
|
+
question(query: string, options: Abortable, callback: (answer: string) => void): void;
|
|
45
46
|
pause(): this;
|
|
46
47
|
resume(): this;
|
|
47
48
|
close(): void;
|
|
@@ -63,8 +64,8 @@ declare module 'readline' {
|
|
|
63
64
|
* 5. SIGCONT
|
|
64
65
|
* 6. SIGINT
|
|
65
66
|
* 7. SIGTSTP
|
|
67
|
+
* 8. history
|
|
66
68
|
*/
|
|
67
|
-
|
|
68
69
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
69
70
|
addListener(event: "close", listener: () => void): this;
|
|
70
71
|
addListener(event: "line", listener: (input: string) => void): this;
|
|
@@ -73,6 +74,7 @@ declare module 'readline' {
|
|
|
73
74
|
addListener(event: "SIGCONT", listener: () => void): this;
|
|
74
75
|
addListener(event: "SIGINT", listener: () => void): this;
|
|
75
76
|
addListener(event: "SIGTSTP", listener: () => void): this;
|
|
77
|
+
addListener(event: "history", listener: (history: string[]) => void): this;
|
|
76
78
|
|
|
77
79
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
78
80
|
emit(event: "close"): boolean;
|
|
@@ -82,6 +84,7 @@ declare module 'readline' {
|
|
|
82
84
|
emit(event: "SIGCONT"): boolean;
|
|
83
85
|
emit(event: "SIGINT"): boolean;
|
|
84
86
|
emit(event: "SIGTSTP"): boolean;
|
|
87
|
+
emit(event: "history", history: string[]): boolean;
|
|
85
88
|
|
|
86
89
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
87
90
|
on(event: "close", listener: () => void): this;
|
|
@@ -91,6 +94,7 @@ declare module 'readline' {
|
|
|
91
94
|
on(event: "SIGCONT", listener: () => void): this;
|
|
92
95
|
on(event: "SIGINT", listener: () => void): this;
|
|
93
96
|
on(event: "SIGTSTP", listener: () => void): this;
|
|
97
|
+
on(event: "history", listener: (history: string[]) => void): this;
|
|
94
98
|
|
|
95
99
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
96
100
|
once(event: "close", listener: () => void): this;
|
|
@@ -100,6 +104,7 @@ declare module 'readline' {
|
|
|
100
104
|
once(event: "SIGCONT", listener: () => void): this;
|
|
101
105
|
once(event: "SIGINT", listener: () => void): this;
|
|
102
106
|
once(event: "SIGTSTP", listener: () => void): this;
|
|
107
|
+
once(event: "history", listener: (history: string[]) => void): this;
|
|
103
108
|
|
|
104
109
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
105
110
|
prependListener(event: "close", listener: () => void): this;
|
|
@@ -109,6 +114,7 @@ declare module 'readline' {
|
|
|
109
114
|
prependListener(event: "SIGCONT", listener: () => void): this;
|
|
110
115
|
prependListener(event: "SIGINT", listener: () => void): this;
|
|
111
116
|
prependListener(event: "SIGTSTP", listener: () => void): this;
|
|
117
|
+
prependListener(event: "history", listener: (history: string[]) => void): this;
|
|
112
118
|
|
|
113
119
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
114
120
|
prependOnceListener(event: "close", listener: () => void): this;
|
|
@@ -118,6 +124,8 @@ declare module 'readline' {
|
|
|
118
124
|
prependOnceListener(event: "SIGCONT", listener: () => void): this;
|
|
119
125
|
prependOnceListener(event: "SIGINT", listener: () => void): this;
|
|
120
126
|
prependOnceListener(event: "SIGTSTP", listener: () => void): this;
|
|
127
|
+
prependOnceListener(event: "history", listener: (history: string[]) => void): this;
|
|
128
|
+
|
|
121
129
|
[Symbol.asyncIterator](): AsyncIterableIterator<string>;
|
|
122
130
|
}
|
|
123
131
|
|
|
@@ -133,9 +141,22 @@ declare module 'readline' {
|
|
|
133
141
|
output?: NodeJS.WritableStream;
|
|
134
142
|
completer?: Completer | AsyncCompleter;
|
|
135
143
|
terminal?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Initial list of history lines. This option makes sense
|
|
146
|
+
* only if `terminal` is set to `true` by the user or by an internal `output`
|
|
147
|
+
* check, otherwise the history caching mechanism is not initialized at all.
|
|
148
|
+
* @default []
|
|
149
|
+
*/
|
|
150
|
+
history?: string[];
|
|
136
151
|
historySize?: number;
|
|
137
152
|
prompt?: string;
|
|
138
153
|
crlfDelay?: number;
|
|
154
|
+
/**
|
|
155
|
+
* If `true`, when a new input line added
|
|
156
|
+
* to the history list duplicates an older one, this removes the older line
|
|
157
|
+
* from the list.
|
|
158
|
+
* @default false
|
|
159
|
+
*/
|
|
139
160
|
removeHistoryDuplicates?: boolean;
|
|
140
161
|
escapeCodeTimeout?: number;
|
|
141
162
|
tabSize?: number;
|
node/stream.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare module 'stream' {
|
|
2
|
-
import EventEmitter
|
|
2
|
+
import { EventEmitter, Abortable } from 'events';
|
|
3
3
|
import * as streamPromises from "stream/promises";
|
|
4
4
|
|
|
5
5
|
class internal extends EventEmitter {
|
|
@@ -11,16 +11,20 @@ declare module 'stream' {
|
|
|
11
11
|
constructor(opts?: ReadableOptions);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
interface
|
|
14
|
+
interface StreamOptions<T extends Stream> extends Abortable {
|
|
15
|
+
emitClose?: boolean;
|
|
15
16
|
highWaterMark?: number;
|
|
16
|
-
encoding?: BufferEncoding;
|
|
17
17
|
objectMode?: boolean;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
destroy?(this: Readable, error: Error | null, callback: (error: Error | null) => void): void;
|
|
18
|
+
construct?(this: T, callback: (error?: Error | null) => void): void;
|
|
19
|
+
destroy?(this: T, error: Error | null, callback: (error: Error | null) => void): void;
|
|
21
20
|
autoDestroy?: boolean;
|
|
22
21
|
}
|
|
23
22
|
|
|
23
|
+
interface ReadableOptions extends StreamOptions<Readable> {
|
|
24
|
+
encoding?: BufferEncoding;
|
|
25
|
+
read?(this: Readable, size: number): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
24
28
|
class Readable extends Stream implements NodeJS.ReadableStream {
|
|
25
29
|
/**
|
|
26
30
|
* A utility method for creating Readable Streams out of iterators.
|
|
@@ -127,18 +131,12 @@ declare module 'stream' {
|
|
|
127
131
|
[Symbol.asyncIterator](): AsyncIterableIterator<any>;
|
|
128
132
|
}
|
|
129
133
|
|
|
130
|
-
interface WritableOptions {
|
|
131
|
-
highWaterMark?: number;
|
|
134
|
+
interface WritableOptions extends StreamOptions<Writable> {
|
|
132
135
|
decodeStrings?: boolean;
|
|
133
136
|
defaultEncoding?: BufferEncoding;
|
|
134
|
-
objectMode?: boolean;
|
|
135
|
-
emitClose?: boolean;
|
|
136
|
-
construct?(this: Writable, callback: (error?: Error | null) => void): void;
|
|
137
137
|
write?(this: Writable, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
|
|
138
138
|
writev?(this: Writable, chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void;
|
|
139
|
-
destroy?(this: Writable, error: Error | null, callback: (error: Error | null) => void): void;
|
|
140
139
|
final?(this: Writable, callback: (error?: Error | null) => void): void;
|
|
141
|
-
autoDestroy?: boolean;
|
|
142
140
|
}
|
|
143
141
|
|
|
144
142
|
class Writable extends Stream implements NodeJS.WritableStream {
|
|
@@ -293,6 +291,16 @@ declare module 'stream' {
|
|
|
293
291
|
|
|
294
292
|
class PassThrough extends Transform { }
|
|
295
293
|
|
|
294
|
+
/**
|
|
295
|
+
* Attaches an AbortSignal to a readable or writeable stream. This lets code
|
|
296
|
+
* control stream destruction using an `AbortController`.
|
|
297
|
+
*
|
|
298
|
+
* Calling `abort` on the `AbortController` corresponding to the passed
|
|
299
|
+
* `AbortSignal` will behave the same way as calling `.destroy(new AbortError())`
|
|
300
|
+
* on the stream.
|
|
301
|
+
*/
|
|
302
|
+
function addAbortSignal<T extends Stream>(signal: AbortSignal, stream: T): T;
|
|
303
|
+
|
|
296
304
|
interface FinishedOptions {
|
|
297
305
|
error?: boolean;
|
|
298
306
|
readable?: boolean;
|
node/timers/promises.d.ts
CHANGED
|
@@ -3,11 +3,19 @@ declare module 'timers/promises' {
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Returns a promise that resolves after the specified delay in milliseconds.
|
|
6
|
+
* @param delay defaults to 1
|
|
6
7
|
*/
|
|
7
|
-
function setTimeout<T>(delay
|
|
8
|
+
function setTimeout<T = void>(delay?: number, value?: T, options?: TimerOptions): Promise<T>;
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Returns a promise that resolves in the next tick.
|
|
11
12
|
*/
|
|
12
|
-
function setImmediate<T>(value
|
|
13
|
+
function setImmediate<T = void>(value?: T, options?: TimerOptions): Promise<T>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* Returns an async iterator that generates values in an interval of delay ms.
|
|
18
|
+
* @param delay defaults to 1
|
|
19
|
+
*/
|
|
20
|
+
function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): AsyncIterable<T>;
|
|
13
21
|
}
|
node/timers.d.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
declare module 'timers' {
|
|
2
|
-
|
|
2
|
+
import { Abortable } from 'events';
|
|
3
|
+
|
|
4
|
+
interface TimerOptions extends Abortable {
|
|
3
5
|
/**
|
|
4
6
|
* Set to `false` to indicate that the scheduled `Timeout`
|
|
5
7
|
* should not require the Node.js event loop to remain active.
|
|
6
8
|
* @default true
|
|
7
9
|
*/
|
|
8
10
|
ref?: boolean;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* An optional `AbortSignal` that can be used to cancel the scheduled `Timeout`.
|
|
12
|
-
*/
|
|
13
|
-
signal?: AbortSignal;
|
|
14
11
|
}
|
|
15
12
|
|
|
16
13
|
function setTimeout(callback: (...args: any[]) => void, ms?: number, ...args: any[]): NodeJS.Timeout;
|
node/tls.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
declare module 'tls' {
|
|
2
|
+
import { X509Certificate } from 'crypto';
|
|
2
3
|
import * as net from 'net';
|
|
3
4
|
|
|
4
5
|
const CLIENT_RENEG_LIMIT: number;
|
|
@@ -295,6 +296,16 @@ declare module 'tls' {
|
|
|
295
296
|
*/
|
|
296
297
|
enableTrace(): void;
|
|
297
298
|
|
|
299
|
+
/**
|
|
300
|
+
* If there is no peer certificate, or the socket has been destroyed, `undefined` will be returned.
|
|
301
|
+
*/
|
|
302
|
+
getPeerX509Certificate(): X509Certificate | undefined;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* If there is no local certificate, or the socket has been destroyed, `undefined` will be returned.
|
|
306
|
+
*/
|
|
307
|
+
getX509Certificate(): X509Certificate | undefined;
|
|
308
|
+
|
|
298
309
|
/**
|
|
299
310
|
* @param length number of bytes to retrieve from keying material
|
|
300
311
|
* @param label an application specific label, typically this will be a value from the
|
|
@@ -553,6 +564,9 @@ declare module 'tls' {
|
|
|
553
564
|
prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
|
|
554
565
|
}
|
|
555
566
|
|
|
567
|
+
/**
|
|
568
|
+
* @deprecated since v0.11.3 Use `tls.TLSSocket` instead.
|
|
569
|
+
*/
|
|
556
570
|
interface SecurePair {
|
|
557
571
|
encrypted: TLSSocket;
|
|
558
572
|
cleartext: TLSSocket;
|
node/util/types.d.ts
CHANGED
node/wasi.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ declare module 'wasi' {
|
|
|
58
58
|
* invoke the `__wasi_unstable_reactor_start()` export. If neither of those exports
|
|
59
59
|
* is present on `instance`, then `start()` does nothing.
|
|
60
60
|
*
|
|
61
|
-
* `start()` requires that `instance` exports a
|
|
61
|
+
* `start()` requires that `instance` exports a `WebAssembly.Memory` named
|
|
62
62
|
* `memory`. If `instance` does not have a `memory` export an exception is thrown.
|
|
63
63
|
*
|
|
64
64
|
* If `start()` is called more than once, an exception is thrown.
|
|
@@ -69,7 +69,7 @@ declare module 'wasi' {
|
|
|
69
69
|
* Attempt to initialize `instance` as a WASI reactor by invoking its `_initialize()` export, if it is present.
|
|
70
70
|
* If `instance` contains a `_start()` export, then an exception is thrown.
|
|
71
71
|
*
|
|
72
|
-
* `start()` requires that `instance` exports a
|
|
72
|
+
* `start()` requires that `instance` exports a `WebAssembly.Memory` named
|
|
73
73
|
* `memory`. If `instance` does not have a `memory` export an exception is thrown.
|
|
74
74
|
*
|
|
75
75
|
* If `initialize()` is called more than once, an exception is thrown.
|
|
@@ -79,7 +79,7 @@ declare module 'wasi' {
|
|
|
79
79
|
/**
|
|
80
80
|
* Is an object that implements the WASI system call API. This object
|
|
81
81
|
* should be passed as the `wasi_snapshot_preview1` import during the instantiation of a
|
|
82
|
-
*
|
|
82
|
+
* `WebAssembly.Instance`.
|
|
83
83
|
*/
|
|
84
84
|
readonly wasiImport: NodeJS.Dict<any>; // TODO: Narrow to DOM types
|
|
85
85
|
}
|
node/worker_threads.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
declare module 'worker_threads' {
|
|
2
|
+
import { Blob } from 'node:buffer';
|
|
2
3
|
import { Context } from 'vm';
|
|
3
|
-
import EventEmitter
|
|
4
|
+
import { EventEmitter } from 'events';
|
|
5
|
+
import { EventLoopUtilityFunction } from 'perf_hooks';
|
|
6
|
+
import { FileHandle } from 'fs/promises';
|
|
4
7
|
import { Readable, Writable } from 'stream';
|
|
5
8
|
import { URL } from 'url';
|
|
6
|
-
import {
|
|
7
|
-
import { EventLoopUtilityFunction } from 'perf_hooks';
|
|
9
|
+
import { X509Certificate } from 'crypto';
|
|
8
10
|
|
|
9
11
|
const isMainThread: boolean;
|
|
10
12
|
const parentPort: null | MessagePort;
|
|
@@ -22,7 +24,7 @@ declare module 'worker_threads' {
|
|
|
22
24
|
eventLoopUtilization: EventLoopUtilityFunction;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
type TransferListItem = ArrayBuffer | MessagePort | FileHandle;
|
|
27
|
+
type TransferListItem = ArrayBuffer | MessagePort | FileHandle | X509Certificate | Blob;
|
|
26
28
|
|
|
27
29
|
class MessagePort extends EventEmitter {
|
|
28
30
|
close(): void;
|
|
@@ -144,11 +146,11 @@ declare module 'worker_threads' {
|
|
|
144
146
|
|
|
145
147
|
/**
|
|
146
148
|
* Returns a readable stream for a V8 snapshot of the current state of the Worker.
|
|
147
|
-
* See
|
|
149
|
+
* See `v8.getHeapSnapshot()` for more details.
|
|
148
150
|
*
|
|
149
151
|
* If the Worker thread is no longer running, which may occur before the
|
|
150
|
-
*
|
|
151
|
-
* immediately with an
|
|
152
|
+
* `'exit'` event is emitted, the returned `Promise` will be rejected
|
|
153
|
+
* immediately with an `ERR_WORKER_NOT_RUNNING` error
|
|
152
154
|
*/
|
|
153
155
|
getHeapSnapshot(): Promise<Readable>;
|
|
154
156
|
|
|
@@ -209,6 +211,22 @@ declare module 'worker_threads' {
|
|
|
209
211
|
off(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
210
212
|
}
|
|
211
213
|
|
|
214
|
+
interface BroadcastChannel extends NodeJS.RefCounted {}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* See https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel
|
|
218
|
+
*/
|
|
219
|
+
class BroadcastChannel {
|
|
220
|
+
readonly name: string;
|
|
221
|
+
onmessage: (message: unknown) => void;
|
|
222
|
+
onmessageerror: (message: unknown) => void;
|
|
223
|
+
|
|
224
|
+
constructor(name: string);
|
|
225
|
+
|
|
226
|
+
close(): void;
|
|
227
|
+
postMessage(message: unknown): void;
|
|
228
|
+
}
|
|
229
|
+
|
|
212
230
|
/**
|
|
213
231
|
* Mark an object as not transferable.
|
|
214
232
|
* If `object` occurs in the transfer list of a `port.postMessage()` call, it will be ignored.
|