@types/node 14.11.7 → 14.11.11

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 CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (http://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Thu, 08 Oct 2020 21:07:26 GMT
11
+ * Last updated: Tue, 20 Oct 2020 06:54:48 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `Buffer`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
14
14
 
node/child_process.d.ts CHANGED
@@ -405,19 +405,23 @@ declare module "child_process" {
405
405
  // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
406
406
  namespace execFile {
407
407
  function __promisify__(file: string): PromiseWithChild<{ stdout: string, stderr: string }>;
408
- function __promisify__(file: string, args: string[] | undefined | null): PromiseWithChild<{ stdout: string, stderr: string }>;
408
+ function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null): PromiseWithChild<{ stdout: string, stderr: string }>;
409
409
  function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
410
- function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
410
+ function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
411
411
  function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
412
- function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
412
+ function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
413
413
  function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
414
- function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
414
+ function __promisify__(
415
+ file: string,
416
+ args: ReadonlyArray<string> | undefined | null,
417
+ options: ExecFileOptionsWithOtherEncoding,
418
+ ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
415
419
  function __promisify__(file: string, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
416
- function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
420
+ function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
417
421
  function __promisify__(file: string, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
418
422
  function __promisify__(
419
423
  file: string,
420
- args: string[] | undefined | null,
424
+ args: ReadonlyArray<string> | undefined | null,
421
425
  options: (BaseEncodingOptions & ExecFileOptions) | undefined | null,
422
426
  ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
423
427
  }
node/console.d.ts CHANGED
@@ -66,7 +66,7 @@ declare module "console" {
66
66
  * This method does not display anything unless used in the inspector.
67
67
  * Prints to `stdout` the array `array` formatted as a table.
68
68
  */
69
- table(tabularData: any, properties?: string[]): void;
69
+ table(tabularData: any, properties?: ReadonlyArray<string>): void;
70
70
  /**
71
71
  * Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique `label`.
72
72
  */
node/dgram.d.ts CHANGED
@@ -50,9 +50,9 @@ declare module "dgram" {
50
50
  getSendBufferSize(): number;
51
51
  ref(): this;
52
52
  remoteAddress(): AddressInfo;
53
- send(msg: string | Uint8Array | any[], port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
54
- send(msg: string | Uint8Array | any[], port?: number, callback?: (error: Error | null, bytes: number) => void): void;
55
- send(msg: string | Uint8Array | any[], callback?: (error: Error | null, bytes: number) => void): void;
53
+ send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
54
+ send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
55
+ send(msg: string | Uint8Array | ReadonlyArray<any>, callback?: (error: Error | null, bytes: number) => void): void;
56
56
  send(msg: string | Uint8Array, offset: number, length: number, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
57
57
  send(msg: string | Uint8Array, offset: number, length: number, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
58
58
  send(msg: string | Uint8Array, offset: number, length: number, callback?: (error: Error | null, bytes: number) => void): void;
node/events.d.ts CHANGED
@@ -70,7 +70,7 @@ declare module "events" {
70
70
  listeners(event: string | symbol): Function[];
71
71
  rawListeners(event: string | symbol): Function[];
72
72
  emit(event: string | symbol, ...args: any[]): boolean;
73
- listenerCount(type: string | symbol): number;
73
+ listenerCount(event: string | symbol): number;
74
74
  // Added in Node 6...
75
75
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
76
76
  prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
node/fs/promises.d.ts CHANGED
@@ -143,12 +143,12 @@ declare module 'fs/promises' {
143
143
  /**
144
144
  * See `fs.writev` promisified version.
145
145
  */
146
- writev(buffers: NodeJS.ArrayBufferView[], position?: number): Promise<WriteVResult>;
146
+ writev(buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<WriteVResult>;
147
147
 
148
148
  /**
149
149
  * See `fs.readv` promisified version.
150
150
  */
151
- readv(buffers: NodeJS.ArrayBufferView[], position?: number): Promise<ReadVResult>;
151
+ readv(buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<ReadVResult>;
152
152
 
153
153
  /**
154
154
  * Asynchronous close(2) - close a `FileHandle`.
node/fs.d.ts CHANGED
@@ -2066,12 +2066,12 @@ declare module "fs" {
2066
2066
  */
2067
2067
  export function writev(
2068
2068
  fd: number,
2069
- buffers: NodeJS.ArrayBufferView[],
2069
+ buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
2070
2070
  cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void
2071
2071
  ): void;
2072
2072
  export function writev(
2073
2073
  fd: number,
2074
- buffers: NodeJS.ArrayBufferView[],
2074
+ buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
2075
2075
  position: number,
2076
2076
  cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void
2077
2077
  ): void;
@@ -2082,22 +2082,22 @@ declare module "fs" {
2082
2082
  }
2083
2083
 
2084
2084
  export namespace writev {
2085
- function __promisify__(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): Promise<WriteVResult>;
2085
+ function __promisify__(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<WriteVResult>;
2086
2086
  }
2087
2087
 
2088
2088
  /**
2089
2089
  * See `writev`.
2090
2090
  */
2091
- export function writevSync(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): number;
2091
+ export function writevSync(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): number;
2092
2092
 
2093
2093
  export function readv(
2094
2094
  fd: number,
2095
- buffers: NodeJS.ArrayBufferView[],
2095
+ buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
2096
2096
  cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void
2097
2097
  ): void;
2098
2098
  export function readv(
2099
2099
  fd: number,
2100
- buffers: NodeJS.ArrayBufferView[],
2100
+ buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
2101
2101
  position: number,
2102
2102
  cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void
2103
2103
  ): void;
@@ -2108,13 +2108,13 @@ declare module "fs" {
2108
2108
  }
2109
2109
 
2110
2110
  export namespace readv {
2111
- function __promisify__(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): Promise<ReadVResult>;
2111
+ function __promisify__(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<ReadVResult>;
2112
2112
  }
2113
2113
 
2114
2114
  /**
2115
2115
  * See `readv`.
2116
2116
  */
2117
- export function readvSync(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): number;
2117
+ export function readvSync(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): number;
2118
2118
 
2119
2119
  export interface OpenDirOptions {
2120
2120
  encoding?: BufferEncoding;
node/globals.d.ts CHANGED
@@ -116,7 +116,7 @@ declare class Buffer extends Uint8Array {
116
116
  * @param array The octets to store.
117
117
  * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
118
118
  */
119
- constructor(array: any[]);
119
+ constructor(array: ReadonlyArray<any>);
120
120
  /**
121
121
  * Copies the passed {buffer} data onto a new {Buffer} instance.
122
122
  *
@@ -137,7 +137,7 @@ declare class Buffer extends Uint8Array {
137
137
  * Creates a new Buffer using the passed {data}
138
138
  * @param data data to create a new Buffer
139
139
  */
140
- static from(data: number[]): Buffer;
140
+ static from(data: ReadonlyArray<number>): Buffer;
141
141
  static from(data: Uint8Array): Buffer;
142
142
  /**
143
143
  * Creates a new buffer containing the coerced value of an object
@@ -191,7 +191,7 @@ declare class Buffer extends Uint8Array {
191
191
  * @param totalLength Total length of the buffers when concatenated.
192
192
  * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
193
193
  */
194
- static concat(list: Uint8Array[], totalLength?: number): Buffer;
194
+ static concat(list: ReadonlyArray<Uint8Array>, totalLength?: number): Buffer;
195
195
  /**
196
196
  * The same as buf1.compare(buf2).
197
197
  */
node/http.d.ts CHANGED
@@ -166,13 +166,13 @@ declare module "http" {
166
166
  constructor();
167
167
 
168
168
  setTimeout(msecs: number, callback?: () => void): this;
169
- setHeader(name: string, value: number | string | string[]): void;
169
+ setHeader(name: string, value: number | string | ReadonlyArray<string>): void;
170
170
  getHeader(name: string): number | string | string[] | undefined;
171
171
  getHeaders(): OutgoingHttpHeaders;
172
172
  getHeaderNames(): string[];
173
173
  hasHeader(name: string): boolean;
174
174
  removeHeader(name: string): void;
175
- addTrailers(headers: OutgoingHttpHeaders | Array<[string, string]>): void;
175
+ addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void;
176
176
  flushHeaders(): void;
177
177
  }
178
178
 
node/http2.d.ts CHANGED
@@ -356,7 +356,7 @@ declare module "http2" {
356
356
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
357
357
 
358
358
  emit(event: "altsvc", alt: string, origin: string, stream: number): boolean;
359
- emit(event: "origin", origins: string[]): boolean;
359
+ emit(event: "origin", origins: ReadonlyArray<string>): boolean;
360
360
  emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
361
361
  emit(event: "stream", stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
362
362
  emit(event: string | symbol, ...args: any[]): boolean;
@@ -571,7 +571,7 @@ declare module "http2" {
571
571
  }
572
572
 
573
573
  export class Http2ServerRequest extends stream.Readable {
574
- constructor(stream: ServerHttp2Stream, headers: IncomingHttpHeaders, options: stream.ReadableOptions, rawHeaders: string[]);
574
+ constructor(stream: ServerHttp2Stream, headers: IncomingHttpHeaders, options: stream.ReadableOptions, rawHeaders: ReadonlyArray<string>);
575
575
 
576
576
  readonly aborted: boolean;
577
577
  readonly authority: string;
@@ -662,7 +662,7 @@ declare module "http2" {
662
662
  getHeaders(): OutgoingHttpHeaders;
663
663
  hasHeader(name: string): boolean;
664
664
  removeHeader(name: string): void;
665
- setHeader(name: string, value: number | string | string[]): void;
665
+ setHeader(name: string, value: number | string | ReadonlyArray<string>): void;
666
666
  setTimeout(msecs: number, callback?: () => void): void;
667
667
  write(chunk: string | Uint8Array, callback?: (err: Error) => void): boolean;
668
668
  write(chunk: string | Uint8Array, encoding: BufferEncoding, callback?: (err: Error) => void): boolean;
node/net.d.ts CHANGED
@@ -71,7 +71,7 @@ declare module "net" {
71
71
  setTimeout(timeout: number, callback?: () => void): this;
72
72
  setNoDelay(noDelay?: boolean): this;
73
73
  setKeepAlive(enable?: boolean, initialDelay?: number): this;
74
- address(): AddressInfo | string;
74
+ address(): AddressInfo | {};
75
75
  unref(): this;
76
76
  ref(): this;
77
77
 
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "14.11.7",
3
+ "version": "14.11.11",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -246,6 +246,6 @@
246
246
  },
247
247
  "scripts": {},
248
248
  "dependencies": {},
249
- "typesPublisherContentHash": "b70f1e09a944f89387adcc4b313eaaad7fa4816fd35f2278a0b73b8135b400a8",
249
+ "typesPublisherContentHash": "c2b0b558a90b2111443786aacee9bd00dccbb5b39a303db22beb1f851fd91469",
250
250
  "typeScriptVersion": "3.2"
251
251
  }
node/perf_hooks.d.ts CHANGED
@@ -186,7 +186,7 @@ declare module 'perf_hooks' {
186
186
  * Property buffered defaults to false.
187
187
  * @param options
188
188
  */
189
- observe(options: { entryTypes: EntryType[]; buffered?: boolean }): void;
189
+ observe(options: { entryTypes: ReadonlyArray<EntryType>; buffered?: boolean }): void;
190
190
  }
191
191
 
192
192
  namespace constants {
node/process.d.ts CHANGED
@@ -209,7 +209,7 @@ declare module "process" {
209
209
  getegid(): number;
210
210
  setegid(id: number | string): void;
211
211
  getgroups(): number[];
212
- setgroups(groups: Array<string | number>): void;
212
+ setgroups(groups: ReadonlyArray<string | number>): void;
213
213
  setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void;
214
214
  hasUncaughtExceptionCaptureCallback(): boolean;
215
215
  version: string;
node/punycode.d.ts CHANGED
@@ -1,12 +1,68 @@
1
1
  declare module "punycode" {
2
+ /**
3
+ * @deprecated since v7.0.0
4
+ * The version of the punycode module bundled in Node.js is being deprecated.
5
+ * In a future major version of Node.js this module will be removed.
6
+ * Users currently depending on the punycode module should switch to using
7
+ * the userland-provided Punycode.js module instead.
8
+ */
2
9
  function decode(string: string): string;
10
+ /**
11
+ * @deprecated since v7.0.0
12
+ * The version of the punycode module bundled in Node.js is being deprecated.
13
+ * In a future major version of Node.js this module will be removed.
14
+ * Users currently depending on the punycode module should switch to using
15
+ * the userland-provided Punycode.js module instead.
16
+ */
3
17
  function encode(string: string): string;
18
+ /**
19
+ * @deprecated since v7.0.0
20
+ * The version of the punycode module bundled in Node.js is being deprecated.
21
+ * In a future major version of Node.js this module will be removed.
22
+ * Users currently depending on the punycode module should switch to using
23
+ * the userland-provided Punycode.js module instead.
24
+ */
4
25
  function toUnicode(domain: string): string;
26
+ /**
27
+ * @deprecated since v7.0.0
28
+ * The version of the punycode module bundled in Node.js is being deprecated.
29
+ * In a future major version of Node.js this module will be removed.
30
+ * Users currently depending on the punycode module should switch to using
31
+ * the userland-provided Punycode.js module instead.
32
+ */
5
33
  function toASCII(domain: string): string;
34
+ /**
35
+ * @deprecated since v7.0.0
36
+ * The version of the punycode module bundled in Node.js is being deprecated.
37
+ * In a future major version of Node.js this module will be removed.
38
+ * Users currently depending on the punycode module should switch to using
39
+ * the userland-provided Punycode.js module instead.
40
+ */
6
41
  const ucs2: ucs2;
7
42
  interface ucs2 {
43
+ /**
44
+ * @deprecated since v7.0.0
45
+ * The version of the punycode module bundled in Node.js is being deprecated.
46
+ * In a future major version of Node.js this module will be removed.
47
+ * Users currently depending on the punycode module should switch to using
48
+ * the userland-provided Punycode.js module instead.
49
+ */
8
50
  decode(string: string): number[];
9
- encode(codePoints: number[]): string;
51
+ /**
52
+ * @deprecated since v7.0.0
53
+ * The version of the punycode module bundled in Node.js is being deprecated.
54
+ * In a future major version of Node.js this module will be removed.
55
+ * Users currently depending on the punycode module should switch to using
56
+ * the userland-provided Punycode.js module instead.
57
+ */
58
+ encode(codePoints: ReadonlyArray<number>): string;
10
59
  }
60
+ /**
61
+ * @deprecated since v7.0.0
62
+ * The version of the punycode module bundled in Node.js is being deprecated.
63
+ * In a future major version of Node.js this module will be removed.
64
+ * Users currently depending on the punycode module should switch to using
65
+ * the userland-provided Punycode.js module instead.
66
+ */
11
67
  const version: string;
12
68
  }
node/stream.d.ts CHANGED
@@ -314,7 +314,10 @@ declare module "stream" {
314
314
  stream5: T,
315
315
  callback?: (err: NodeJS.ErrnoException | null) => void,
316
316
  ): T;
317
- function pipeline(streams: Array<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>, callback?: (err: NodeJS.ErrnoException | null) => void): NodeJS.WritableStream;
317
+ function pipeline(
318
+ streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
319
+ callback?: (err: NodeJS.ErrnoException | null) => void,
320
+ ): NodeJS.WritableStream;
318
321
  function pipeline(
319
322
  stream1: NodeJS.ReadableStream,
320
323
  stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
@@ -331,7 +334,7 @@ declare module "stream" {
331
334
  stream4: NodeJS.ReadWriteStream,
332
335
  stream5: NodeJS.WritableStream,
333
336
  ): Promise<void>;
334
- function __promisify__(streams: Array<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>): Promise<void>;
337
+ function __promisify__(streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>): Promise<void>;
335
338
  function __promisify__(
336
339
  stream1: NodeJS.ReadableStream,
337
340
  stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
node/url.d.ts CHANGED
@@ -92,7 +92,7 @@ declare module "url" {
92
92
  }
93
93
 
94
94
  class URLSearchParams implements Iterable<[string, string]> {
95
- constructor(init?: URLSearchParams | string | NodeJS.Dict<string | string[]> | Iterable<[string, string]> | Array<[string, string]>);
95
+ constructor(init?: URLSearchParams | string | NodeJS.Dict<string | ReadonlyArray<string>> | Iterable<[string, string]> | ReadonlyArray<[string, string]>);
96
96
  append(name: string, value: string): void;
97
97
  delete(name: string): void;
98
98
  entries(): IterableIterator<[string, string]>;
node/vm.d.ts CHANGED
@@ -125,7 +125,7 @@ declare module "vm" {
125
125
  function runInContext(code: string, contextifiedSandbox: Context, options?: RunningScriptOptions | string): any;
126
126
  function runInNewContext(code: string, sandbox?: Context, options?: RunningScriptOptions | string): any;
127
127
  function runInThisContext(code: string, options?: RunningScriptOptions | string): any;
128
- function compileFunction(code: string, params?: string[], options?: CompileFunctionOptions): Function;
128
+ function compileFunction(code: string, params?: ReadonlyArray<string>, options?: CompileFunctionOptions): Function;
129
129
 
130
130
  /**
131
131
  * Measure the memory known to V8 and used by the current execution context or a specified context.
node/worker_threads.d.ts CHANGED
@@ -3,9 +3,11 @@ declare module "worker_threads" {
3
3
  import { EventEmitter } from "events";
4
4
  import { Readable, Writable } from "stream";
5
5
  import { URL } from "url";
6
+ import { FileHandle } from "fs/promises";
6
7
 
7
8
  const isMainThread: boolean;
8
9
  const parentPort: null | MessagePort;
10
+ const resourceLimits: ResourceLimits;
9
11
  const SHARE_ENV: unique symbol;
10
12
  const threadId: number;
11
13
  const workerData: any;
@@ -15,43 +17,53 @@ declare module "worker_threads" {
15
17
  readonly port2: MessagePort;
16
18
  }
17
19
 
20
+ type TransferListItem = ArrayBuffer | MessagePort | FileHandle;
21
+
18
22
  class MessagePort extends EventEmitter {
19
23
  close(): void;
20
- postMessage(value: any, transferList?: Array<ArrayBuffer | MessagePort>): void;
24
+ postMessage(value: any, transferList?: ReadonlyArray<TransferListItem>): void;
21
25
  ref(): void;
22
26
  unref(): void;
23
27
  start(): void;
24
28
 
25
29
  addListener(event: "close", listener: () => void): this;
26
30
  addListener(event: "message", listener: (value: any) => void): this;
31
+ addListener(event: "messageerror", listener: (error: Error) => void): this;
27
32
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
28
33
 
29
34
  emit(event: "close"): boolean;
30
35
  emit(event: "message", value: any): boolean;
36
+ emit(event: "messageerror", error: Error): boolean;
31
37
  emit(event: string | symbol, ...args: any[]): boolean;
32
38
 
33
39
  on(event: "close", listener: () => void): this;
34
40
  on(event: "message", listener: (value: any) => void): this;
41
+ on(event: "messageerror", listener: (error: Error) => void): this;
35
42
  on(event: string | symbol, listener: (...args: any[]) => void): this;
36
43
 
37
44
  once(event: "close", listener: () => void): this;
38
45
  once(event: "message", listener: (value: any) => void): this;
46
+ once(event: "messageerror", listener: (error: Error) => void): this;
39
47
  once(event: string | symbol, listener: (...args: any[]) => void): this;
40
48
 
41
49
  prependListener(event: "close", listener: () => void): this;
42
50
  prependListener(event: "message", listener: (value: any) => void): this;
51
+ prependListener(event: "messageerror", listener: (error: Error) => void): this;
43
52
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
44
53
 
45
54
  prependOnceListener(event: "close", listener: () => void): this;
46
55
  prependOnceListener(event: "message", listener: (value: any) => void): this;
56
+ prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
47
57
  prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
48
58
 
49
59
  removeListener(event: "close", listener: () => void): this;
50
60
  removeListener(event: "message", listener: (value: any) => void): this;
61
+ removeListener(event: "messageerror", listener: (error: Error) => void): this;
51
62
  removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
52
63
 
53
64
  off(event: "close", listener: () => void): this;
54
65
  off(event: "message", listener: (value: any) => void): this;
66
+ off(event: "messageerror", listener: (error: Error) => void): this;
55
67
  off(event: string | symbol, listener: (...args: any[]) => void): this;
56
68
  }
57
69
 
@@ -74,14 +86,28 @@ declare module "worker_threads" {
74
86
  /**
75
87
  * Additional data to send in the first worker message.
76
88
  */
77
- transferList?: Array<ArrayBuffer | MessagePort>;
89
+ transferList?: TransferListItem[];
78
90
  trackUnmanagedFds?: boolean;
79
91
  }
80
92
 
81
93
  interface ResourceLimits {
94
+ /**
95
+ * The maximum size of a heap space for recently created objects.
96
+ */
82
97
  maxYoungGenerationSizeMb?: number;
98
+ /**
99
+ * The maximum size of the main heap in MB.
100
+ */
83
101
  maxOldGenerationSizeMb?: number;
102
+ /**
103
+ * The size of a pre-allocated memory range used for generated code.
104
+ */
84
105
  codeRangeSizeMb?: number;
106
+ /**
107
+ * The default maximum stack size for the thread. Small values may lead to unusable Worker instances.
108
+ * @default 4
109
+ */
110
+ stackSizeMb?: number;
85
111
  }
86
112
 
87
113
  class Worker extends EventEmitter {
@@ -98,7 +124,7 @@ declare module "worker_threads" {
98
124
  */
99
125
  constructor(filename: string | URL, options?: WorkerOptions);
100
126
 
101
- postMessage(value: any, transferList?: Array<ArrayBuffer | MessagePort>): void;
127
+ postMessage(value: any, transferList?: ReadonlyArray<TransferListItem>): void;
102
128
  ref(): void;
103
129
  unref(): void;
104
130
  /**
@@ -120,52 +146,72 @@ declare module "worker_threads" {
120
146
  addListener(event: "error", listener: (err: Error) => void): this;
121
147
  addListener(event: "exit", listener: (exitCode: number) => void): this;
122
148
  addListener(event: "message", listener: (value: any) => void): this;
149
+ addListener(event: "messageerror", listener: (error: Error) => void): this;
123
150
  addListener(event: "online", listener: () => void): this;
124
151
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
125
152
 
126
153
  emit(event: "error", err: Error): boolean;
127
154
  emit(event: "exit", exitCode: number): boolean;
128
155
  emit(event: "message", value: any): boolean;
156
+ emit(event: "messageerror", error: Error): boolean;
129
157
  emit(event: "online"): boolean;
130
158
  emit(event: string | symbol, ...args: any[]): boolean;
131
159
 
132
160
  on(event: "error", listener: (err: Error) => void): this;
133
161
  on(event: "exit", listener: (exitCode: number) => void): this;
134
162
  on(event: "message", listener: (value: any) => void): this;
163
+ on(event: "messageerror", listener: (error: Error) => void): this;
135
164
  on(event: "online", listener: () => void): this;
136
165
  on(event: string | symbol, listener: (...args: any[]) => void): this;
137
166
 
138
167
  once(event: "error", listener: (err: Error) => void): this;
139
168
  once(event: "exit", listener: (exitCode: number) => void): this;
140
169
  once(event: "message", listener: (value: any) => void): this;
170
+ once(event: "messageerror", listener: (error: Error) => void): this;
141
171
  once(event: "online", listener: () => void): this;
142
172
  once(event: string | symbol, listener: (...args: any[]) => void): this;
143
173
 
144
174
  prependListener(event: "error", listener: (err: Error) => void): this;
145
175
  prependListener(event: "exit", listener: (exitCode: number) => void): this;
146
176
  prependListener(event: "message", listener: (value: any) => void): this;
177
+ prependListener(event: "messageerror", listener: (error: Error) => void): this;
147
178
  prependListener(event: "online", listener: () => void): this;
148
179
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
149
180
 
150
181
  prependOnceListener(event: "error", listener: (err: Error) => void): this;
151
182
  prependOnceListener(event: "exit", listener: (exitCode: number) => void): this;
152
183
  prependOnceListener(event: "message", listener: (value: any) => void): this;
184
+ prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
153
185
  prependOnceListener(event: "online", listener: () => void): this;
154
186
  prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
155
187
 
156
188
  removeListener(event: "error", listener: (err: Error) => void): this;
157
189
  removeListener(event: "exit", listener: (exitCode: number) => void): this;
158
190
  removeListener(event: "message", listener: (value: any) => void): this;
191
+ removeListener(event: "messageerror", listener: (error: Error) => void): this;
159
192
  removeListener(event: "online", listener: () => void): this;
160
193
  removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
161
194
 
162
195
  off(event: "error", listener: (err: Error) => void): this;
163
196
  off(event: "exit", listener: (exitCode: number) => void): this;
164
197
  off(event: "message", listener: (value: any) => void): this;
198
+ off(event: "messageerror", listener: (error: Error) => void): this;
165
199
  off(event: "online", listener: () => void): this;
166
200
  off(event: string | symbol, listener: (...args: any[]) => void): this;
167
201
  }
168
202
 
203
+ /**
204
+ * Mark an object as not transferable.
205
+ * If `object` occurs in the transfer list of a `port.postMessage()` call, it will be ignored.
206
+ *
207
+ * In particular, this makes sense for objects that can be cloned, rather than transferred,
208
+ * and which are used by other objects on the sending side. For example, Node.js marks
209
+ * the `ArrayBuffer`s it uses for its Buffer pool with this.
210
+ *
211
+ * This operation cannot be undone.
212
+ */
213
+ function markAsUntransferable(object: object): void;
214
+
169
215
  /**
170
216
  * Transfer a `MessagePort` to a different `vm` Context. The original `port`
171
217
  * object will be rendered unusable, and the returned `MessagePort` instance will