@types/node 13.9.7 → 13.13.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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) Microsoft Corporation. All rights reserved.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
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: Mon, 30 Mar 2020 23:25:20 GMT
11
+ * Last updated: Fri, 17 Apr 2020 21:12:26 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `Buffer`, `Symbol`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
14
14
 
node/async_hooks.d.ts CHANGED
@@ -143,4 +143,105 @@ declare module "async_hooks" {
143
143
  */
144
144
  triggerAsyncId(): number;
145
145
  }
146
+
147
+ /**
148
+ * When having multiple instances of `AsyncLocalStorage`, they are independent
149
+ * from each other. It is safe to instantiate this class multiple times.
150
+ */
151
+ class AsyncLocalStorage<T> {
152
+ /**
153
+ * This method disables the instance of `AsyncLocalStorage`. All subsequent calls
154
+ * to `asyncLocalStorage.getStore()` will return `undefined` until
155
+ * `asyncLocalStorage.run()` or `asyncLocalStorage.runSyncAndReturn()`
156
+ * is called again.
157
+ *
158
+ * When calling `asyncLocalStorage.disable()`, all current contexts linked to the
159
+ * instance will be exited.
160
+ *
161
+ * Calling `asyncLocalStorage.disable()` is required before the
162
+ * `asyncLocalStorage` can be garbage collected. This does not apply to stores
163
+ * provided by the `asyncLocalStorage`, as those objects are garbage collected
164
+ * along with the corresponding async resources.
165
+ *
166
+ * This method is to be used when the `asyncLocalStorage` is not in use anymore
167
+ * in the current process.
168
+ */
169
+ disable(): void;
170
+
171
+ /**
172
+ * This method returns the current store.
173
+ * If this method is called outside of an asynchronous context initialized by
174
+ * calling `asyncLocalStorage.run` or `asyncLocalStorage.runAndReturn`, it will
175
+ * return `undefined`.
176
+ */
177
+ getStore(): T | undefined;
178
+
179
+ /**
180
+ * Calling `asyncLocalStorage.run(callback)` will create a new asynchronous
181
+ * context.
182
+ * Within the callback function and the asynchronous operations from the callback,
183
+ * `asyncLocalStorage.getStore()` will return an instance of `Map` known as
184
+ * "the store". This store will be persistent through the following
185
+ * asynchronous calls.
186
+ *
187
+ * The callback will be ran asynchronously. Optionally, arguments can be passed
188
+ * to the function. They will be passed to the callback function.
189
+ *
190
+ * If an error is thrown by the callback function, it will not be caught by
191
+ * a `try/catch` block as the callback is ran in a new asynchronous resource.
192
+ * Also, the stacktrace will be impacted by the asynchronous call.
193
+ */
194
+ // TODO: Apply generic vararg once available
195
+ run(store: T, callback: (...args: any[]) => void, ...args: any[]): void;
196
+
197
+ /**
198
+ * Calling `asyncLocalStorage.exit(callback)` will create a new asynchronous
199
+ * context.
200
+ * Within the callback function and the asynchronous operations from the callback,
201
+ * `asyncLocalStorage.getStore()` will return `undefined`.
202
+ *
203
+ * The callback will be ran asynchronously. Optionally, arguments can be passed
204
+ * to the function. They will be passed to the callback function.
205
+ *
206
+ * If an error is thrown by the callback function, it will not be caught by
207
+ * a `try/catch` block as the callback is ran in a new asynchronous resource.
208
+ * Also, the stacktrace will be impacted by the asynchronous call.
209
+ */
210
+ exit(callback: (...args: any[]) => void, ...args: any[]): void;
211
+
212
+ /**
213
+ * This methods runs a function synchronously within a context and return its
214
+ * return value. The store is not accessible outside of the callback function or
215
+ * the asynchronous operations created within the callback.
216
+ *
217
+ * Optionally, arguments can be passed to the function. They will be passed to
218
+ * the callback function.
219
+ *
220
+ * If the callback function throws an error, it will be thrown by
221
+ * `runSyncAndReturn` too. The stacktrace will not be impacted by this call and
222
+ * the context will be exited.
223
+ */
224
+ runSyncAndReturn<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R;
225
+
226
+ /**
227
+ * This methods runs a function synchronously outside of a context and return its
228
+ * return value. The store is not accessible within the callback function or
229
+ * the asynchronous operations created within the callback.
230
+ *
231
+ * Optionally, arguments can be passed to the function. They will be passed to
232
+ * the callback function.
233
+ *
234
+ * If the callback function throws an error, it will be thrown by
235
+ * `exitSyncAndReturn` too. The stacktrace will not be impacted by this call and
236
+ * the context will be re-entered.
237
+ */
238
+ exitSyncAndReturn<R>(callback: (...args: any[]) => R, ...args: any[]): R;
239
+
240
+ /**
241
+ * Calling `asyncLocalStorage.enterWith(store)` will transition into the context
242
+ * for the remainder of the current synchronous execution and will persist
243
+ * through any following asynchronous calls.
244
+ */
245
+ enterWith(store: T): void;
246
+ }
146
247
  }
node/child_process.d.ts CHANGED
@@ -133,7 +133,7 @@ declare module "child_process" {
133
133
  uid?: number;
134
134
  gid?: number;
135
135
  cwd?: string;
136
- env?: NodeJS.ProcessEnv;
136
+ env?: NodeJS.Dict<string>;
137
137
  }
138
138
 
139
139
  interface CommonOptions extends ProcessEnvOptions {
node/cluster.d.ts CHANGED
@@ -100,9 +100,7 @@ declare module "cluster" {
100
100
  settings: ClusterSettings;
101
101
  setupMaster(settings?: ClusterSettings): void;
102
102
  worker?: Worker;
103
- workers?: {
104
- [index: string]: Worker | undefined
105
- };
103
+ workers?: NodeJS.Dict<Worker>;
106
104
 
107
105
  readonly SCHED_NONE: number;
108
106
  readonly SCHED_RR: number;
@@ -184,9 +182,7 @@ declare module "cluster" {
184
182
  const settings: ClusterSettings;
185
183
  function setupMaster(settings?: ClusterSettings): void;
186
184
  const worker: Worker;
187
- const workers: {
188
- [index: string]: Worker | undefined
189
- };
185
+ const workers: NodeJS.Dict<Worker>;
190
186
 
191
187
  /**
192
188
  * events.EventEmitter
node/dns.d.ts CHANGED
@@ -2,6 +2,11 @@ declare module "dns" {
2
2
  // Supported getaddrinfo flags.
3
3
  const ADDRCONFIG: number;
4
4
  const V4MAPPED: number;
5
+ /**
6
+ * If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as
7
+ * well as IPv4 mapped IPv6 addresses.
8
+ */
9
+ const ALL: number;
5
10
 
6
11
  interface LookupOptions {
7
12
  family?: number;
node/fs.d.ts CHANGED
@@ -134,62 +134,131 @@ declare module "fs" {
134
134
  close(): void;
135
135
  bytesRead: number;
136
136
  path: string | Buffer;
137
+ pending: boolean;
137
138
 
138
139
  /**
139
140
  * events.EventEmitter
140
141
  * 1. open
141
142
  * 2. close
143
+ * 3. ready
142
144
  */
143
- addListener(event: string, listener: (...args: any[]) => void): this;
144
- addListener(event: "open", listener: (fd: number) => void): this;
145
145
  addListener(event: "close", listener: () => void): this;
146
+ addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
147
+ addListener(event: "end", listener: () => void): this;
148
+ addListener(event: "error", listener: (err: Error) => void): this;
149
+ addListener(event: "open", listener: (fd: number) => void): this;
150
+ addListener(event: "pause", listener: () => void): this;
151
+ addListener(event: "readable", listener: () => void): this;
152
+ addListener(event: "ready", listener: () => void): this;
153
+ addListener(event: "resume", listener: () => void): this;
154
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
146
155
 
147
- on(event: string, listener: (...args: any[]) => void): this;
148
- on(event: "open", listener: (fd: number) => void): this;
149
156
  on(event: "close", listener: () => void): this;
157
+ on(event: "data", listener: (chunk: Buffer | string) => void): this;
158
+ on(event: "end", listener: () => void): this;
159
+ on(event: "error", listener: (err: Error) => void): this;
160
+ on(event: "open", listener: (fd: number) => void): this;
161
+ on(event: "pause", listener: () => void): this;
162
+ on(event: "readable", listener: () => void): this;
163
+ on(event: "ready", listener: () => void): this;
164
+ on(event: "resume", listener: () => void): this;
165
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
150
166
 
151
- once(event: string, listener: (...args: any[]) => void): this;
152
- once(event: "open", listener: (fd: number) => void): this;
153
167
  once(event: "close", listener: () => void): this;
168
+ once(event: "data", listener: (chunk: Buffer | string) => void): this;
169
+ once(event: "end", listener: () => void): this;
170
+ once(event: "error", listener: (err: Error) => void): this;
171
+ once(event: "open", listener: (fd: number) => void): this;
172
+ once(event: "pause", listener: () => void): this;
173
+ once(event: "readable", listener: () => void): this;
174
+ once(event: "ready", listener: () => void): this;
175
+ once(event: "resume", listener: () => void): this;
176
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
154
177
 
155
- prependListener(event: string, listener: (...args: any[]) => void): this;
156
- prependListener(event: "open", listener: (fd: number) => void): this;
157
178
  prependListener(event: "close", listener: () => void): this;
179
+ prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
180
+ prependListener(event: "end", listener: () => void): this;
181
+ prependListener(event: "error", listener: (err: Error) => void): this;
182
+ prependListener(event: "open", listener: (fd: number) => void): this;
183
+ prependListener(event: "pause", listener: () => void): this;
184
+ prependListener(event: "readable", listener: () => void): this;
185
+ prependListener(event: "ready", listener: () => void): this;
186
+ prependListener(event: "resume", listener: () => void): this;
187
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
158
188
 
159
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
160
- prependOnceListener(event: "open", listener: (fd: number) => void): this;
161
189
  prependOnceListener(event: "close", listener: () => void): this;
190
+ prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
191
+ prependOnceListener(event: "end", listener: () => void): this;
192
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
193
+ prependOnceListener(event: "open", listener: (fd: number) => void): this;
194
+ prependOnceListener(event: "pause", listener: () => void): this;
195
+ prependOnceListener(event: "readable", listener: () => void): this;
196
+ prependOnceListener(event: "ready", listener: () => void): this;
197
+ prependOnceListener(event: "resume", listener: () => void): this;
198
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
162
199
  }
163
200
 
164
201
  class WriteStream extends stream.Writable {
165
202
  close(): void;
166
203
  bytesWritten: number;
167
204
  path: string | Buffer;
205
+ pending: boolean;
168
206
 
169
207
  /**
170
208
  * events.EventEmitter
171
209
  * 1. open
172
210
  * 2. close
211
+ * 3. ready
173
212
  */
174
- addListener(event: string, listener: (...args: any[]) => void): this;
175
- addListener(event: "open", listener: (fd: number) => void): this;
176
213
  addListener(event: "close", listener: () => void): this;
214
+ addListener(event: "drain", listener: () => void): this;
215
+ addListener(event: "error", listener: (err: Error) => void): this;
216
+ addListener(event: "finish", listener: () => void): this;
217
+ addListener(event: "open", listener: (fd: number) => void): this;
218
+ addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
219
+ addListener(event: "ready", listener: () => void): this;
220
+ addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
221
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
177
222
 
178
- on(event: string, listener: (...args: any[]) => void): this;
179
- on(event: "open", listener: (fd: number) => void): this;
180
223
  on(event: "close", listener: () => void): this;
224
+ on(event: "drain", listener: () => void): this;
225
+ on(event: "error", listener: (err: Error) => void): this;
226
+ on(event: "finish", listener: () => void): this;
227
+ on(event: "open", listener: (fd: number) => void): this;
228
+ on(event: "pipe", listener: (src: stream.Readable) => void): this;
229
+ on(event: "ready", listener: () => void): this;
230
+ on(event: "unpipe", listener: (src: stream.Readable) => void): this;
231
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
181
232
 
182
- once(event: string, listener: (...args: any[]) => void): this;
183
- once(event: "open", listener: (fd: number) => void): this;
184
233
  once(event: "close", listener: () => void): this;
234
+ once(event: "drain", listener: () => void): this;
235
+ once(event: "error", listener: (err: Error) => void): this;
236
+ once(event: "finish", listener: () => void): this;
237
+ once(event: "open", listener: (fd: number) => void): this;
238
+ once(event: "pipe", listener: (src: stream.Readable) => void): this;
239
+ once(event: "ready", listener: () => void): this;
240
+ once(event: "unpipe", listener: (src: stream.Readable) => void): this;
241
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
185
242
 
186
- prependListener(event: string, listener: (...args: any[]) => void): this;
187
- prependListener(event: "open", listener: (fd: number) => void): this;
188
243
  prependListener(event: "close", listener: () => void): this;
244
+ prependListener(event: "drain", listener: () => void): this;
245
+ prependListener(event: "error", listener: (err: Error) => void): this;
246
+ prependListener(event: "finish", listener: () => void): this;
247
+ prependListener(event: "open", listener: (fd: number) => void): this;
248
+ prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
249
+ prependListener(event: "ready", listener: () => void): this;
250
+ prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
251
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
189
252
 
190
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
191
- prependOnceListener(event: "open", listener: (fd: number) => void): this;
192
253
  prependOnceListener(event: "close", listener: () => void): this;
254
+ prependOnceListener(event: "drain", listener: () => void): this;
255
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
256
+ prependOnceListener(event: "finish", listener: () => void): this;
257
+ prependOnceListener(event: "open", listener: (fd: number) => void): this;
258
+ prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
259
+ prependOnceListener(event: "ready", listener: () => void): this;
260
+ prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
261
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
193
262
  }
194
263
 
195
264
  /**
@@ -786,12 +855,13 @@ declare module "fs" {
786
855
  interface MakeDirectoryOptions {
787
856
  /**
788
857
  * Indicates whether parent folders should be created.
858
+ * If a folder was created, the path to the first created folder will be returned.
789
859
  * @default false
790
860
  */
791
861
  recursive?: boolean;
792
862
  /**
793
863
  * A file mode. If a string is passed, it is parsed as an octal integer. If not specified
794
- * @default 0o777.
864
+ * @default 0o777
795
865
  */
796
866
  mode?: number | string;
797
867
  }
@@ -802,7 +872,23 @@ declare module "fs" {
802
872
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
803
873
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
804
874
  */
805
- function mkdir(path: PathLike, options: number | string | MakeDirectoryOptions | undefined | null, callback: NoParamCallback): void;
875
+ function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true }, callback: (err: NodeJS.ErrnoException | null, path: string) => void): void;
876
+
877
+ /**
878
+ * Asynchronous mkdir(2) - create a directory.
879
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
880
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
881
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
882
+ */
883
+ function mkdir(path: PathLike, options: number | string | (MakeDirectoryOptions & { recursive?: false; }) | null | undefined, callback: NoParamCallback): void;
884
+
885
+ /**
886
+ * Asynchronous mkdir(2) - create a directory.
887
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
888
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
889
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
890
+ */
891
+ function mkdir(path: PathLike, options: number | string | MakeDirectoryOptions | null | undefined, callback: (err: NodeJS.ErrnoException | null, path: string | undefined) => void): void;
806
892
 
807
893
  /**
808
894
  * Asynchronous mkdir(2) - create a directory with a mode of `0o777`.
@@ -818,7 +904,23 @@ declare module "fs" {
818
904
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
819
905
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
820
906
  */
821
- function __promisify__(path: PathLike, options?: number | string | MakeDirectoryOptions | null): Promise<void>;
907
+ function __promisify__(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise<string>;
908
+
909
+ /**
910
+ * Asynchronous mkdir(2) - create a directory.
911
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
912
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
913
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
914
+ */
915
+ function __promisify__(path: PathLike, options?: number | string | (MakeDirectoryOptions & { recursive?: false; }) | null): Promise<void>;
916
+
917
+ /**
918
+ * Asynchronous mkdir(2) - create a directory.
919
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
920
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
921
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
922
+ */
923
+ function __promisify__(path: PathLike, options?: number | string | MakeDirectoryOptions | null): Promise<string | undefined>;
822
924
  }
823
925
 
824
926
  /**
@@ -827,7 +929,23 @@ declare module "fs" {
827
929
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
828
930
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
829
931
  */
830
- function mkdirSync(path: PathLike, options?: number | string | MakeDirectoryOptions | null): void;
932
+ function mkdirSync(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): string;
933
+
934
+ /**
935
+ * Synchronous mkdir(2) - create a directory.
936
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
937
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
938
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
939
+ */
940
+ function mkdirSync(path: PathLike, options?: number | string | (MakeDirectoryOptions & { recursive?: false; }) | null): void;
941
+
942
+ /**
943
+ * Synchronous mkdir(2) - create a directory.
944
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
945
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
946
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
947
+ */
948
+ function mkdirSync(path: PathLike, options?: number | string | MakeDirectoryOptions | null): string | undefined;
831
949
 
832
950
  /**
833
951
  * Asynchronously creates a unique temporary directory.
@@ -1286,6 +1404,21 @@ declare module "fs" {
1286
1404
  ): Promise<{ bytesRead: number, buffer: TBuffer }>;
1287
1405
  }
1288
1406
 
1407
+ interface ReadSyncOptions {
1408
+ /**
1409
+ * @default 0
1410
+ */
1411
+ offset?: number;
1412
+ /**
1413
+ * @default `length of buffer`
1414
+ */
1415
+ length?: number;
1416
+ /**
1417
+ * @default null
1418
+ */
1419
+ position?: number | null;
1420
+ }
1421
+
1289
1422
  /**
1290
1423
  * Synchronously reads data from the file referenced by the supplied file descriptor, returning the number of bytes read.
1291
1424
  * @param fd A file descriptor.
@@ -1296,6 +1429,12 @@ declare module "fs" {
1296
1429
  */
1297
1430
  function readSync(fd: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position: number | null): number;
1298
1431
 
1432
+ /**
1433
+ * Similar to the above `fs.readSync` function, this version takes an optional `options` object.
1434
+ * If no `options` object is specified, it will default with the above values.
1435
+ */
1436
+ function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadSyncOptions): number;
1437
+
1299
1438
  /**
1300
1439
  * Asynchronously reads the entire contents of a file.
1301
1440
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1933,6 +2072,32 @@ declare module "fs" {
1933
2072
  */
1934
2073
  function writevSync(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): number;
1935
2074
 
2075
+ function readv(
2076
+ fd: number,
2077
+ buffers: NodeJS.ArrayBufferView[],
2078
+ cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void
2079
+ ): void;
2080
+ function readv(
2081
+ fd: number,
2082
+ buffers: NodeJS.ArrayBufferView[],
2083
+ position: number,
2084
+ cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void
2085
+ ): void;
2086
+
2087
+ interface ReadVResult {
2088
+ bytesRead: number;
2089
+ buffers: NodeJS.ArrayBufferView[];
2090
+ }
2091
+
2092
+ namespace readv {
2093
+ function __promisify__(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): Promise<ReadVResult>;
2094
+ }
2095
+
2096
+ /**
2097
+ * See `readv`.
2098
+ */
2099
+ function readvSync(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): number;
2100
+
1936
2101
  interface OpenDirOptions {
1937
2102
  encoding?: BufferEncoding;
1938
2103
  /**
@@ -2084,6 +2249,11 @@ declare module "fs" {
2084
2249
  */
2085
2250
  writev(buffers: NodeJS.ArrayBufferView[], position?: number): Promise<WriteVResult>;
2086
2251
 
2252
+ /**
2253
+ * See `fs.readv` promisified version.
2254
+ */
2255
+ readv(buffers: NodeJS.ArrayBufferView[], position?: number): Promise<ReadVResult>;
2256
+
2087
2257
  /**
2088
2258
  * Asynchronous close(2) - close a `FileHandle`.
2089
2259
  */
@@ -2209,7 +2379,23 @@ declare module "fs" {
2209
2379
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
2210
2380
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
2211
2381
  */
2212
- function mkdir(path: PathLike, options?: number | string | MakeDirectoryOptions | null): Promise<void>;
2382
+ function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise<string>;
2383
+
2384
+ /**
2385
+ * Asynchronous mkdir(2) - create a directory.
2386
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2387
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
2388
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
2389
+ */
2390
+ function mkdir(path: PathLike, options?: number | string | (MakeDirectoryOptions & { recursive?: false; }) | null): Promise<void>;
2391
+
2392
+ /**
2393
+ * Asynchronous mkdir(2) - create a directory.
2394
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2395
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
2396
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
2397
+ */
2398
+ function mkdir(path: PathLike, options?: number | string | MakeDirectoryOptions | null): Promise<string | undefined>;
2213
2399
 
2214
2400
  /**
2215
2401
  * Asynchronous readdir(3) - read a directory.
node/globals.d.ts CHANGED
@@ -432,6 +432,13 @@ declare namespace NodeJS {
432
432
  customInspect?: boolean;
433
433
  showProxy?: boolean;
434
434
  maxArrayLength?: number | null;
435
+ /**
436
+ * Specifies the maximum number of characters to
437
+ * include when formatting. Set to `null` or `Infinity` to show all elements.
438
+ * Set to `0` or negative to show no characters.
439
+ * @default Infinity
440
+ */
441
+ maxStringLength?: number | null;
435
442
  breakLength?: number;
436
443
  /**
437
444
  * Setting this to `false` causes each object key
@@ -669,9 +676,8 @@ declare namespace NodeJS {
669
676
  isTTY?: true;
670
677
  }
671
678
 
672
- interface ProcessEnv {
673
- [key: string]: string | undefined;
674
- }
679
+ // Alias for compability
680
+ type ProcessEnv = Dict<string>;
675
681
 
676
682
  interface HRTime {
677
683
  (time?: [number, number]): [number, number];
@@ -781,7 +787,7 @@ declare namespace NodeJS {
781
787
  cwd(): string;
782
788
  debugPort: number;
783
789
  emitWarning(warning: string | Error, name?: string, ctor?: Function): void;
784
- env: ProcessEnv;
790
+ env: Dict<string>;
785
791
  exit(code?: number): never;
786
792
  exitCode?: number;
787
793
  getgid(): number;
@@ -1066,15 +1072,11 @@ declare namespace NodeJS {
1066
1072
  type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array;
1067
1073
  type ArrayBufferView = TypedArray | DataView;
1068
1074
 
1069
- interface NodeRequireCache {
1070
- [path: string]: NodeModule;
1071
- }
1072
-
1073
1075
  interface Require {
1074
1076
  /* tslint:disable-next-line:callable-types */
1075
1077
  (id: string): any;
1076
1078
  resolve: RequireResolve;
1077
- cache: NodeRequireCache;
1079
+ cache: Dict<NodeModule>;
1078
1080
  /**
1079
1081
  * @deprecated
1080
1082
  */
@@ -1087,11 +1089,10 @@ declare namespace NodeJS {
1087
1089
  paths(request: string): string[] | null;
1088
1090
  }
1089
1091
 
1090
- interface RequireExtensions {
1092
+ interface RequireExtensions extends Dict<(m: Module, filename: string) => any> {
1091
1093
  '.js': (m: Module, filename: string) => any;
1092
1094
  '.json': (m: Module, filename: string) => any;
1093
1095
  '.node': (m: Module, filename: string) => any;
1094
- [ext: string]: (m: Module, filename: string) => any;
1095
1096
  }
1096
1097
  interface Module {
1097
1098
  exports: any;
@@ -1103,4 +1104,12 @@ declare namespace NodeJS {
1103
1104
  children: Module[];
1104
1105
  paths: string[];
1105
1106
  }
1107
+
1108
+ interface Dict<T> {
1109
+ [key: string]: T | undefined;
1110
+ }
1111
+
1112
+ interface ReadOnlyDict<T> {
1113
+ readonly [key: string]: T | undefined;
1114
+ }
1106
1115
  }
node/http.d.ts CHANGED
@@ -5,7 +5,7 @@ declare module "http" {
5
5
  import { Socket, Server as NetServer } from "net";
6
6
 
7
7
  // incoming headers will never contain number
8
- interface IncomingHttpHeaders {
8
+ interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
9
9
  'accept'?: string;
10
10
  'accept-language'?: string;
11
11
  'accept-patch'?: string;
@@ -60,12 +60,10 @@ declare module "http" {
60
60
  'via'?: string;
61
61
  'warning'?: string;
62
62
  'www-authenticate'?: string;
63
- [header: string]: string | string[] | undefined;
64
63
  }
65
64
 
66
65
  // outgoing headers allows numbers (as they are converted internally to strings)
67
- interface OutgoingHttpHeaders {
68
- [header: string]: number | string | string[] | undefined;
66
+ interface OutgoingHttpHeaders extends NodeJS.Dict<number | string | string[]> {
69
67
  }
70
68
 
71
69
  interface ClientRequestArgs {
@@ -309,7 +307,7 @@ declare module "http" {
309
307
  socket: Socket;
310
308
  headers: IncomingHttpHeaders;
311
309
  rawHeaders: string[];
312
- trailers: { [key: string]: string | undefined };
310
+ trailers: NodeJS.Dict<string>;
313
311
  rawTrailers: string[];
314
312
  setTimeout(msecs: number, callback?: () => void): this;
315
313
  /**
@@ -358,12 +356,8 @@ declare module "http" {
358
356
  class Agent {
359
357
  maxFreeSockets: number;
360
358
  maxSockets: number;
361
- readonly sockets: {
362
- readonly [key: string]: Socket[];
363
- };
364
- readonly requests: {
365
- readonly [key: string]: IncomingMessage[];
366
- };
359
+ readonly sockets: NodeJS.ReadOnlyDict<Socket[]>;
360
+ readonly requests: NodeJS.ReadOnlyDict<IncomingMessage[]>;
367
361
 
368
362
  constructor(opts?: AgentOptions);
369
363
 
@@ -397,7 +391,7 @@ declare module "http" {
397
391
 
398
392
  /**
399
393
  * Read-only property specifying the maximum allowed size of HTTP headers in bytes.
400
- * Defaults to 8KB. Configurable using the [`--max-http-header-size`][] CLI option.
394
+ * Defaults to 16KB. Configurable using the [`--max-http-header-size`][] CLI option.
401
395
  */
402
396
  const maxHeaderSize: number;
403
397
  }
node/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for non-npm package Node.js 13.9
1
+ // Type definitions for non-npm package Node.js 13.13
2
2
  // Project: http://nodejs.org/
3
3
  // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4
4
  // DefinitelyTyped <https://github.com/DefinitelyTyped>
node/os.d.ts CHANGED
@@ -46,7 +46,7 @@ declare module "os" {
46
46
  function cpus(): CpuInfo[];
47
47
  function type(): string;
48
48
  function release(): string;
49
- function networkInterfaces(): { [index: string]: NetworkInterfaceInfo[] };
49
+ function networkInterfaces(): NodeJS.Dict<NetworkInterfaceInfo[]>;
50
50
  function homedir(): string;
51
51
  function userInfo(options: { encoding: 'buffer' }): UserInfo<Buffer>;
52
52
  function userInfo(options?: { encoding: string }): UserInfo<string>;
@@ -209,6 +209,14 @@ declare module "os" {
209
209
  }
210
210
 
211
211
  function arch(): string;
212
+ /**
213
+ * Returns a string identifying the kernel version.
214
+ * On POSIX systems, the operating system release is determined by calling
215
+ * [uname(3)][]. On Windows, `pRtlGetVersion` is used, and if it is not available,
216
+ * `GetVersionExW()` will be used. See
217
+ * https://en.wikipedia.org/wiki/Uname#Examples for more information.
218
+ */
219
+ function version(): string;
212
220
  function platform(): NodeJS.Platform;
213
221
  function tmpdir(): string;
214
222
  const EOL: string;
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "13.9.7",
3
+ "version": "13.13.0",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -241,6 +241,6 @@
241
241
  },
242
242
  "scripts": {},
243
243
  "dependencies": {},
244
- "typesPublisherContentHash": "5a856633d07b31351fbb78a5f166278b3f1f9eb97d54de748e29cce7d35c348d",
244
+ "typesPublisherContentHash": "4f8a799311cb18d7931c234954099ba8b81f773e68db688d35c6bc5dc7485e4b",
245
245
  "typeScriptVersion": "2.8"
246
246
  }
node/querystring.d.ts CHANGED
@@ -8,10 +8,9 @@ declare module "querystring" {
8
8
  decodeURIComponent?: (str: string) => string;
9
9
  }
10
10
 
11
- interface ParsedUrlQuery { [key: string]: string | string[]; }
11
+ interface ParsedUrlQuery extends NodeJS.Dict<string | string[]> { }
12
12
 
13
- interface ParsedUrlQueryInput {
14
- [key: string]: string | number | boolean | string[] | number[] | boolean[] | undefined | null;
13
+ interface ParsedUrlQueryInput extends NodeJS.Dict<string | number | boolean | string[] | number[] | boolean[] | null> {
15
14
  }
16
15
 
17
16
  function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string;
node/repl.d.ts CHANGED
@@ -146,7 +146,7 @@ declare module "repl" {
146
146
  /**
147
147
  * The commands registered via `replServer.defineCommand()`.
148
148
  */
149
- readonly commands: { readonly [name: string]: REPLCommand | undefined };
149
+ readonly commands: NodeJS.ReadOnlyDict<REPLCommand>;
150
150
  /**
151
151
  * A value indicating whether the REPL is currently in "editor mode".
152
152
  *
node/stream.d.ts CHANGED
@@ -50,56 +50,72 @@ declare module "stream" {
50
50
  * 1. close
51
51
  * 2. data
52
52
  * 3. end
53
- * 4. readable
54
- * 5. error
53
+ * 4. error
54
+ * 5. pause
55
+ * 6. readable
56
+ * 7. resume
55
57
  */
56
58
  addListener(event: "close", listener: () => void): this;
57
59
  addListener(event: "data", listener: (chunk: any) => void): this;
58
60
  addListener(event: "end", listener: () => void): this;
59
- addListener(event: "readable", listener: () => void): this;
60
61
  addListener(event: "error", listener: (err: Error) => void): this;
62
+ addListener(event: "pause", listener: () => void): this;
63
+ addListener(event: "readable", listener: () => void): this;
64
+ addListener(event: "resume", listener: () => void): this;
61
65
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
62
66
 
63
67
  emit(event: "close"): boolean;
64
68
  emit(event: "data", chunk: any): boolean;
65
69
  emit(event: "end"): boolean;
66
- emit(event: "readable"): boolean;
67
70
  emit(event: "error", err: Error): boolean;
71
+ emit(event: "pause"): boolean;
72
+ emit(event: "readable"): boolean;
73
+ emit(event: "resume"): boolean;
68
74
  emit(event: string | symbol, ...args: any[]): boolean;
69
75
 
70
76
  on(event: "close", listener: () => void): this;
71
77
  on(event: "data", listener: (chunk: any) => void): this;
72
78
  on(event: "end", listener: () => void): this;
73
- on(event: "readable", listener: () => void): this;
74
79
  on(event: "error", listener: (err: Error) => void): this;
80
+ on(event: "pause", listener: () => void): this;
81
+ on(event: "readable", listener: () => void): this;
82
+ on(event: "resume", listener: () => void): this;
75
83
  on(event: string | symbol, listener: (...args: any[]) => void): this;
76
84
 
77
85
  once(event: "close", listener: () => void): this;
78
86
  once(event: "data", listener: (chunk: any) => void): this;
79
87
  once(event: "end", listener: () => void): this;
80
- once(event: "readable", listener: () => void): this;
81
88
  once(event: "error", listener: (err: Error) => void): this;
89
+ once(event: "pause", listener: () => void): this;
90
+ once(event: "readable", listener: () => void): this;
91
+ once(event: "resume", listener: () => void): this;
82
92
  once(event: string | symbol, listener: (...args: any[]) => void): this;
83
93
 
84
94
  prependListener(event: "close", listener: () => void): this;
85
95
  prependListener(event: "data", listener: (chunk: any) => void): this;
86
96
  prependListener(event: "end", listener: () => void): this;
87
- prependListener(event: "readable", listener: () => void): this;
88
97
  prependListener(event: "error", listener: (err: Error) => void): this;
98
+ prependListener(event: "pause", listener: () => void): this;
99
+ prependListener(event: "readable", listener: () => void): this;
100
+ prependListener(event: "resume", listener: () => void): this;
89
101
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
90
102
 
91
103
  prependOnceListener(event: "close", listener: () => void): this;
92
104
  prependOnceListener(event: "data", listener: (chunk: any) => void): this;
93
105
  prependOnceListener(event: "end", listener: () => void): this;
94
- prependOnceListener(event: "readable", listener: () => void): this;
95
106
  prependOnceListener(event: "error", listener: (err: Error) => void): this;
107
+ prependOnceListener(event: "pause", listener: () => void): this;
108
+ prependOnceListener(event: "readable", listener: () => void): this;
109
+ prependOnceListener(event: "resume", listener: () => void): this;
96
110
  prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
97
111
 
98
112
  removeListener(event: "close", listener: () => void): this;
99
113
  removeListener(event: "data", listener: (chunk: any) => void): this;
100
114
  removeListener(event: "end", listener: () => void): this;
101
- removeListener(event: "readable", listener: () => void): this;
102
115
  removeListener(event: "error", listener: (err: Error) => void): this;
116
+ removeListener(event: "pause", listener: () => void): this;
117
+ removeListener(event: "readable", listener: () => void): this;
118
+ removeListener(event: "resume", listener: () => void): this;
103
119
  removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
104
120
 
105
121
  [Symbol.asyncIterator](): AsyncIterableIterator<any>;
node/tls.d.ts CHANGED
@@ -38,12 +38,13 @@ declare module "tls" {
38
38
  subject: Certificate;
39
39
  issuer: Certificate;
40
40
  subjectaltname: string;
41
- infoAccess: { [index: string]: string[] | undefined };
41
+ infoAccess: NodeJS.Dict<string[]>;
42
42
  modulus: string;
43
43
  exponent: string;
44
44
  valid_from: string;
45
45
  valid_to: string;
46
46
  fingerprint: string;
47
+ fingerprint256: string;
47
48
  ext_key_usage: string[];
48
49
  serialNumber: string;
49
50
  raw: Buffer;
@@ -297,6 +298,14 @@ declare module "tls" {
297
298
  */
298
299
  enableTrace(): void;
299
300
 
301
+ /**
302
+ * @param length number of bytes to retrieve from keying material
303
+ * @param label an application specific label, typically this will be a value from the
304
+ * [IANA Exporter Label Registry](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels).
305
+ * @param context optionally provide a context.
306
+ */
307
+ exportKeyingMaterial(length: number, label: string, context: Buffer): Buffer;
308
+
300
309
  addListener(event: string, listener: (...args: any[]) => void): this;
301
310
  addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
302
311
  addListener(event: "secureConnect", listener: () => void): this;
node/ts3.5/wasi.d.ts CHANGED
@@ -17,9 +17,16 @@ declare module 'wasi' {
17
17
  * directories within the sandbox. The corresponding values in `preopens` are
18
18
  * the real paths to those directories on the host machine.
19
19
  */
20
- preopens?: {
21
- [key: string]: string;
22
- };
20
+ preopens?: NodeJS.Dict<string>;
21
+
22
+ /**
23
+ * By default, WASI applications terminate the Node.js
24
+ * process via the `__wasi_proc_exit()` function. Setting this option to `true`
25
+ * causes `wasi.start()` to return the exit code rather than terminate the
26
+ * process.
27
+ * @default false
28
+ */
29
+ returnOnExit?: boolean;
23
30
  }
24
31
 
25
32
  class WASI {
@@ -40,6 +47,6 @@ declare module 'wasi' {
40
47
  * should be passed as the `wasi_unstable` import during the instantiation of a
41
48
  * [`WebAssembly.Instance`][].
42
49
  */
43
- readonly wasiImport: { [key: string]: any }; // TODO: Narrow to DOM types
50
+ readonly wasiImport: NodeJS.Dict<any>; // TODO: Narrow to DOM types
44
51
  }
45
52
  }
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 | { [key: string]: string | string[] | undefined } | Iterable<[string, string]> | Array<[string, string]>);
95
+ constructor(init?: URLSearchParams | string | NodeJS.Dict<string | string[]> | Iterable<[string, string]> | Array<[string, string]>);
96
96
  append(name: string, value: string): void;
97
97
  delete(name: string): void;
98
98
  entries(): IterableIterator<[string, string]>;
node/util.d.ts CHANGED
@@ -12,9 +12,7 @@ declare module "util" {
12
12
  function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
13
13
  function inspect(object: any, options: InspectOptions): string;
14
14
  namespace inspect {
15
- let colors: {
16
- [color: string]: [number, number] | undefined
17
- };
15
+ let colors: NodeJS.Dict<[number, number]>;
18
16
  let styles: {
19
17
  [K in Style]: string
20
18
  };
node/vm.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  declare module "vm" {
2
- interface Context {
3
- [key: string]: any;
4
- }
2
+ interface Context extends NodeJS.Dict<any> { }
5
3
  interface BaseOptions {
6
4
  /**
7
5
  * Specifies the filename used in stack traces produced by this script.
@@ -94,6 +92,23 @@ declare module "vm" {
94
92
  };
95
93
  }
96
94
 
95
+ type MeasureMemoryMode = 'summary' | 'detailed';
96
+
97
+ interface MeasureMemoryOptions {
98
+ /**
99
+ * @default 'summary'
100
+ */
101
+ mode?: MeasureMemoryMode;
102
+ context?: Context;
103
+ }
104
+
105
+ interface MemoryMeasurement {
106
+ total: {
107
+ jsMemoryEstimate: number;
108
+ jsMemoryRange: [number, number];
109
+ };
110
+ }
111
+
97
112
  class Script {
98
113
  constructor(code: string, options?: ScriptOptions);
99
114
  runInContext(contextifiedSandbox: Context, options?: RunningScriptOptions): any;
@@ -107,4 +122,21 @@ declare module "vm" {
107
122
  function runInNewContext(code: string, sandbox?: Context, options?: RunningScriptOptions | string): any;
108
123
  function runInThisContext(code: string, options?: RunningScriptOptions | string): any;
109
124
  function compileFunction(code: string, params?: string[], options?: CompileFunctionOptions): Function;
125
+
126
+ /**
127
+ * Measure the memory known to V8 and used by the current execution context or a specified context.
128
+ *
129
+ * The format of the object that the returned Promise may resolve with is
130
+ * specific to the V8 engine and may change from one version of V8 to the next.
131
+ *
132
+ * The returned result is different from the statistics returned by
133
+ * `v8.getHeapSpaceStatistics()` in that `vm.measureMemory()` measures
134
+ * the memory reachable by V8 from a specific context, while
135
+ * `v8.getHeapSpaceStatistics()` measures the memory used by an instance
136
+ * of V8 engine, which can switch among multiple contexts that reference
137
+ * objects in the heap of one engine.
138
+ *
139
+ * @experimental
140
+ */
141
+ function measureMemory(options?: MeasureMemoryOptions): Promise<MemoryMeasurement>;
110
142
  }
node/worker_threads.d.ts CHANGED
@@ -2,6 +2,7 @@ declare module "worker_threads" {
2
2
  import { Context } from "vm";
3
3
  import { EventEmitter } from "events";
4
4
  import { Readable, Writable } from "stream";
5
+ import { URL } from "url";
5
6
 
6
7
  const isMainThread: boolean;
7
8
  const parentPort: null | MessagePort;
@@ -62,7 +63,7 @@ declare module "worker_threads" {
62
63
  * were passed as CLI options to the script.
63
64
  */
64
65
  argv?: any[];
65
- env?: NodeJS.ProcessEnv | typeof SHARE_ENV;
66
+ env?: NodeJS.Dict<string> | typeof SHARE_ENV;
66
67
  eval?: boolean;
67
68
  workerData?: any;
68
69
  stdin?: boolean;
@@ -70,6 +71,10 @@ declare module "worker_threads" {
70
71
  stderr?: boolean;
71
72
  execArgv?: string[];
72
73
  resourceLimits?: ResourceLimits;
74
+ /**
75
+ * Additional data to send in the first worker message.
76
+ */
77
+ transferList?: Array<ArrayBuffer | MessagePort>;
73
78
  }
74
79
 
75
80
  interface ResourceLimits {
@@ -85,7 +90,12 @@ declare module "worker_threads" {
85
90
  readonly threadId: number;
86
91
  readonly resourceLimits?: ResourceLimits;
87
92
 
88
- constructor(filename: string, options?: WorkerOptions);
93
+ /**
94
+ * @param filename The path to the Worker’s main script or module.
95
+ * Must be either an absolute path or a relative path (i.e. relative to the current working directory) starting with ./ or ../,
96
+ * or a WHATWG URL object using file: protocol. If options.eval is true, this is a string containing JavaScript code rather than a path.
97
+ */
98
+ constructor(filename: string | URL, options?: WorkerOptions);
89
99
 
90
100
  postMessage(value: any, transferList?: Array<ArrayBuffer | MessagePort>): void;
91
101
  ref(): void;