@types/node 13.9.8 → 13.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
node/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:55:11 GMT
11
+ * Last updated: Mon, 20 Apr 2020 16:28:04 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/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
@@ -855,12 +855,13 @@ declare module "fs" {
855
855
  interface MakeDirectoryOptions {
856
856
  /**
857
857
  * Indicates whether parent folders should be created.
858
+ * If a folder was created, the path to the first created folder will be returned.
858
859
  * @default false
859
860
  */
860
861
  recursive?: boolean;
861
862
  /**
862
863
  * A file mode. If a string is passed, it is parsed as an octal integer. If not specified
863
- * @default 0o777.
864
+ * @default 0o777
864
865
  */
865
866
  mode?: number | string;
866
867
  }
@@ -871,7 +872,23 @@ declare module "fs" {
871
872
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
872
873
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
873
874
  */
874
- 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;
875
892
 
876
893
  /**
877
894
  * Asynchronous mkdir(2) - create a directory with a mode of `0o777`.
@@ -887,7 +904,23 @@ declare module "fs" {
887
904
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
888
905
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
889
906
  */
890
- 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>;
891
924
  }
892
925
 
893
926
  /**
@@ -896,7 +929,23 @@ declare module "fs" {
896
929
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
897
930
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
898
931
  */
899
- 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;
900
949
 
901
950
  /**
902
951
  * Asynchronously creates a unique temporary directory.
@@ -1355,6 +1404,21 @@ declare module "fs" {
1355
1404
  ): Promise<{ bytesRead: number, buffer: TBuffer }>;
1356
1405
  }
1357
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
+
1358
1422
  /**
1359
1423
  * Synchronously reads data from the file referenced by the supplied file descriptor, returning the number of bytes read.
1360
1424
  * @param fd A file descriptor.
@@ -1365,6 +1429,12 @@ declare module "fs" {
1365
1429
  */
1366
1430
  function readSync(fd: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position: number | null): number;
1367
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
+
1368
1438
  /**
1369
1439
  * Asynchronously reads the entire contents of a file.
1370
1440
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2002,6 +2072,32 @@ declare module "fs" {
2002
2072
  */
2003
2073
  function writevSync(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): number;
2004
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
+
2005
2101
  interface OpenDirOptions {
2006
2102
  encoding?: BufferEncoding;
2007
2103
  /**
@@ -2153,6 +2249,11 @@ declare module "fs" {
2153
2249
  */
2154
2250
  writev(buffers: NodeJS.ArrayBufferView[], position?: number): Promise<WriteVResult>;
2155
2251
 
2252
+ /**
2253
+ * See `fs.readv` promisified version.
2254
+ */
2255
+ readv(buffers: NodeJS.ArrayBufferView[], position?: number): Promise<ReadVResult>;
2256
+
2156
2257
  /**
2157
2258
  * Asynchronous close(2) - close a `FileHandle`.
2158
2259
  */
@@ -2278,7 +2379,23 @@ declare module "fs" {
2278
2379
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
2279
2380
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
2280
2381
  */
2281
- 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>;
2282
2399
 
2283
2400
  /**
2284
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 compatibility
680
+ interface ProcessEnv extends Dict<string> {}
675
681
 
676
682
  interface HRTime {
677
683
  (time?: [number, number]): [number, 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.8",
3
+ "version": "13.13.1",
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": "4afc60d20762ae5e8022b1c639024bd9cbf6587ba8a32200e2209dda295e8e46",
244
+ "typesPublisherContentHash": "591b3799a73e412587cd03b0a69fd21b70f4b95fa606b60b698dc9c3f2593729",
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/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;