@types/node 15.6.2 → 15.12.2
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 +9 -4
- node/console.d.ts +9 -9
- node/crypto.d.ts +129 -7
- node/dgram.d.ts +2 -2
- node/fs/promises.d.ts +34 -0
- node/fs.d.ts +19 -46
- node/globals.d.ts +5 -3
- node/http.d.ts +14 -6
- node/http2.d.ts +7 -0
- node/index.d.ts +6 -6
- node/os.d.ts +1 -1
- node/package.json +2 -2
- node/perf_hooks.d.ts +55 -22
- node/process.d.ts +1 -1
- node/readline.d.ts +23 -2
- node/stream.d.ts +1 -1
- node/timers/promises.d.ts +10 -2
- node/timers.d.ts +3 -6
- node/tls.d.ts +11 -0
- node/ts3.6/base.d.ts +4 -4
- node/ts3.6/index.d.ts +1 -1
- node/wasi.d.ts +3 -3
- node/worker_threads.d.ts +22 -4
node/stream.d.ts
CHANGED
|
@@ -301,7 +301,7 @@ declare module 'stream' {
|
|
|
301
301
|
*/
|
|
302
302
|
function addAbortSignal<T extends Stream>(signal: AbortSignal, stream: T): T;
|
|
303
303
|
|
|
304
|
-
interface FinishedOptions {
|
|
304
|
+
interface FinishedOptions extends Abortable {
|
|
305
305
|
error?: boolean;
|
|
306
306
|
readable?: boolean;
|
|
307
307
|
writable?: 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
|
node/ts3.6/base.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
|
|
4
4
|
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
|
|
5
5
|
// - ~/index.d.ts - Definitions specific to TypeScript 3.7 and above
|
|
6
|
-
// - ~/ts3.
|
|
7
|
-
// - ~/ts3.
|
|
6
|
+
// - ~/ts3.6/base.d.ts - Definitions specific to TypeScript 3.6 and earlier
|
|
7
|
+
// - ~/ts3.6/index.d.ts - Definitions specific to TypeScript 3.6 and earlier with assert pulled in
|
|
8
8
|
|
|
9
9
|
// Reference required types from the default lib:
|
|
10
10
|
/// <reference lib="es2018" />
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
/// <reference path="../worker_threads.d.ts" />
|
|
62
62
|
/// <reference path="../zlib.d.ts" />
|
|
63
63
|
|
|
64
|
-
// TypeScript 3.
|
|
64
|
+
// TypeScript 3.6-specific augmentations:
|
|
65
65
|
/// <reference path="../globals.global.d.ts" />
|
|
66
66
|
|
|
67
|
-
// TypeScript 3.
|
|
67
|
+
// TypeScript 3.6-specific augmentations:
|
|
68
68
|
/// <reference path="../wasi.d.ts" />
|
node/ts3.6/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// NOTE: These definitions support NodeJS and TypeScript 3.
|
|
1
|
+
// NOTE: These definitions support NodeJS and TypeScript 3.6.
|
|
2
2
|
// This is required to enable typing assert in ts3.7 without causing errors
|
|
3
3
|
// Typically type modifications should be made in base.d.ts instead of here
|
|
4
4
|
|
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,4 +1,5 @@
|
|
|
1
1
|
declare module 'worker_threads' {
|
|
2
|
+
import { Blob } from 'node:buffer';
|
|
2
3
|
import { Context } from 'vm';
|
|
3
4
|
import { EventEmitter } from 'events';
|
|
4
5
|
import { EventLoopUtilityFunction } from 'perf_hooks';
|
|
@@ -23,7 +24,7 @@ declare module 'worker_threads' {
|
|
|
23
24
|
eventLoopUtilization: EventLoopUtilityFunction;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
type TransferListItem = ArrayBuffer | MessagePort | FileHandle | X509Certificate;
|
|
27
|
+
type TransferListItem = ArrayBuffer | MessagePort | FileHandle | X509Certificate | Blob;
|
|
27
28
|
|
|
28
29
|
class MessagePort extends EventEmitter {
|
|
29
30
|
close(): void;
|
|
@@ -145,11 +146,11 @@ declare module 'worker_threads' {
|
|
|
145
146
|
|
|
146
147
|
/**
|
|
147
148
|
* Returns a readable stream for a V8 snapshot of the current state of the Worker.
|
|
148
|
-
* See
|
|
149
|
+
* See `v8.getHeapSnapshot()` for more details.
|
|
149
150
|
*
|
|
150
151
|
* If the Worker thread is no longer running, which may occur before the
|
|
151
|
-
*
|
|
152
|
-
* immediately with an
|
|
152
|
+
* `'exit'` event is emitted, the returned `Promise` will be rejected
|
|
153
|
+
* immediately with an `ERR_WORKER_NOT_RUNNING` error
|
|
153
154
|
*/
|
|
154
155
|
getHeapSnapshot(): Promise<Readable>;
|
|
155
156
|
|
|
@@ -261,4 +262,21 @@ declare module 'worker_threads' {
|
|
|
261
262
|
* `MessagePort`’s queue.
|
|
262
263
|
*/
|
|
263
264
|
function receiveMessageOnPort(port: MessagePort): { message: any } | undefined;
|
|
265
|
+
|
|
266
|
+
type Serializable = string | object | number | boolean | bigint;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
|
|
270
|
+
* @experimental
|
|
271
|
+
*/
|
|
272
|
+
function getEnvironmentData(key: Serializable): Serializable;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
|
|
276
|
+
* @param value Any arbitrary, cloneable JavaScript value that will be cloned
|
|
277
|
+
* and passed automatically to all new `Worker` instances. If `value` is passed
|
|
278
|
+
* as `undefined`, any previously set value for the `key` will be deleted.
|
|
279
|
+
* @experimental
|
|
280
|
+
*/
|
|
281
|
+
function setEnvironmentData(key: Serializable, value: Serializable): void;
|
|
264
282
|
}
|