@types/node 13.11.0 → 13.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
node/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: Thu, 02 Apr 2020 16:50:50 GMT
11
+ * Last updated: Wed, 22 Apr 2020 02:24:00 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/assert.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  declare module "assert" {
2
- function internal(value: any, message?: string | Error): void;
3
- namespace internal {
2
+ function assert(value: any, message?: string | Error): void;
3
+ namespace assert {
4
4
  class AssertionError implements Error {
5
5
  name: string;
6
6
  message: string;
@@ -22,9 +22,13 @@ declare module "assert" {
22
22
  /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
23
23
  function fail(actual: any, expected: any, message?: string | Error, operator?: string, stackStartFn?: Function): never;
24
24
  function ok(value: any, message?: string | Error): void;
25
+ /** @deprecated since v9.9.0 - use strictEqual() instead. */
25
26
  function equal(actual: any, expected: any, message?: string | Error): void;
27
+ /** @deprecated since v9.9.0 - use notStrictEqual() instead. */
26
28
  function notEqual(actual: any, expected: any, message?: string | Error): void;
29
+ /** @deprecated since v9.9.0 - use deepStrictEqual() instead. */
27
30
  function deepEqual(actual: any, expected: any, message?: string | Error): void;
31
+ /** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */
28
32
  function notDeepEqual(actual: any, expected: any, message?: string | Error): void;
29
33
  function strictEqual(actual: any, expected: any, message?: string | Error): void;
30
34
  function notStrictEqual(actual: any, expected: any, message?: string | Error): void;
@@ -46,8 +50,8 @@ declare module "assert" {
46
50
  function match(value: string, regExp: RegExp, message?: string | Error): void;
47
51
  function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
48
52
 
49
- const strict: typeof internal;
53
+ const strict: typeof assert;
50
54
  }
51
55
 
52
- export = internal;
56
+ export = assert;
53
57
  }
node/base.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  // base definnitions for all NodeJS modules that are not specific to any version of TypeScript
2
2
  /// <reference path="globals.d.ts" />
3
- /// <reference path="assert.d.ts" />
4
3
  /// <reference path="async_hooks.d.ts" />
5
4
  /// <reference path="buffer.d.ts" />
6
5
  /// <reference path="child_process.d.ts" />
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
@@ -1404,6 +1404,21 @@ declare module "fs" {
1404
1404
  ): Promise<{ bytesRead: number, buffer: TBuffer }>;
1405
1405
  }
1406
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
+
1407
1422
  /**
1408
1423
  * Synchronously reads data from the file referenced by the supplied file descriptor, returning the number of bytes read.
1409
1424
  * @param fd A file descriptor.
@@ -1414,6 +1429,12 @@ declare module "fs" {
1414
1429
  */
1415
1430
  function readSync(fd: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position: number | null): number;
1416
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
+
1417
1438
  /**
1418
1439
  * Asynchronously reads the entire contents of a file.
1419
1440
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2051,6 +2072,32 @@ declare module "fs" {
2051
2072
  */
2052
2073
  function writevSync(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): number;
2053
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
+
2054
2101
  interface OpenDirOptions {
2055
2102
  encoding?: BufferEncoding;
2056
2103
  /**
@@ -2202,6 +2249,11 @@ declare module "fs" {
2202
2249
  */
2203
2250
  writev(buffers: NodeJS.ArrayBufferView[], position?: number): Promise<WriteVResult>;
2204
2251
 
2252
+ /**
2253
+ * See `fs.readv` promisified version.
2254
+ */
2255
+ readv(buffers: NodeJS.ArrayBufferView[], position?: number): Promise<ReadVResult>;
2256
+
2205
2257
  /**
2206
2258
  * Asynchronous close(2) - close a `FileHandle`.
2207
2259
  */
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.11
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>
@@ -59,6 +59,9 @@
59
59
  // Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
60
60
  /// <reference path="base.d.ts" />
61
61
 
62
+ // We can't include assert.d.ts in base.d.ts, as it'll cause duplication errors in +ts3.7
63
+ /// <reference path="assert.d.ts" />
64
+
62
65
  // Forward-declarations for needed types from es2015 and later (in case users are using `--lib es5`)
63
66
  // Empty interfaces are used here which merge fine with the real declarations in the lib XXX files
64
67
  // just to ensure the names are known and node typings can be used without importing these libs.
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>;
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "13.11.0",
3
+ "version": "13.13.2",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -232,6 +232,11 @@
232
232
  "*": [
233
233
  "ts3.5/*"
234
234
  ]
235
+ },
236
+ ">=3.7.0-0": {
237
+ "*": [
238
+ "ts3.7/*"
239
+ ]
235
240
  }
236
241
  },
237
242
  "repository": {
@@ -241,6 +246,6 @@
241
246
  },
242
247
  "scripts": {},
243
248
  "dependencies": {},
244
- "typesPublisherContentHash": "0fbeeb0b6e4acddc36e24b1455120076db2e6b76112dcb47230f57c67093c74e",
249
+ "typesPublisherContentHash": "57cfc32a2e6aa482bfd078aa0560ba17922bc022cb7b435dea5d619f183a1cb1",
245
250
  "typeScriptVersion": "2.8"
246
251
  }
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;
node/ts3.2/base.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ // NOTE: These definitions support NodeJS and TypeScript 3.2.
2
+
3
+ // NOTE: TypeScript version-specific augmentations can be found in the following paths:
4
+ // - ~/base.d.ts - Shared definitions common to all TypeScript versions
5
+ // - ~/index.d.ts - Definitions specific to TypeScript 2.1
6
+ // - ~/ts3.2/base.d.ts - Definitions specific to TypeScript 3.2
7
+ // - ~/ts3.2/index.d.ts - Definitions specific to TypeScript 3.2 with assert pulled in
8
+
9
+ // Reference required types from the default lib:
10
+ /// <reference lib="es2018" />
11
+ /// <reference lib="esnext.asynciterable" />
12
+ /// <reference lib="esnext.intl" />
13
+ /// <reference lib="esnext.bigint" />
14
+
15
+ // Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
16
+ // tslint:disable-next-line:no-bad-reference
17
+ /// <reference path="../base.d.ts" />
18
+
19
+ // TypeScript 3.2-specific augmentations:
20
+ /// <reference path="fs.d.ts" />
21
+ /// <reference path="util.d.ts" />
22
+ /// <reference path="globals.d.ts" />
node/ts3.2/index.d.ts CHANGED
@@ -1,16 +1,8 @@
1
1
  // NOTE: These definitions support NodeJS and TypeScript 3.2.
2
+ // This is requried to enable typing assert in ts3.7 without causing errors
3
+ // Typically type modifiations should be made in base.d.ts instead of here
2
4
 
3
- // Reference required types from the default lib:
4
- /// <reference lib="es2018" />
5
- /// <reference lib="esnext.asynciterable" />
6
- /// <reference lib="esnext.intl" />
7
- /// <reference lib="esnext.bigint" />
5
+ /// <reference path="base.d.ts" />
8
6
 
9
- // Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
10
7
  // tslint:disable-next-line:no-bad-reference
11
- /// <reference path="../base.d.ts" />
12
-
13
- // TypeScript 3.2-specific augmentations:
14
- /// <reference path="fs.d.ts" />
15
- /// <reference path="util.d.ts" />
16
- /// <reference path="globals.d.ts" />
8
+ /// <reference path="../assert.d.ts" />
node/ts3.5/base.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ // NOTE: These definitions support NodeJS and TypeScript 3.5.
2
+
3
+ // NOTE: TypeScript version-specific augmentations can be found in the following paths:
4
+ // - ~/base.d.ts - Shared definitions common to all TypeScript versions
5
+ // - ~/index.d.ts - Definitions specific to TypeScript 2.1
6
+ // - ~/ts3.5/base.d.ts - Definitions specific to TypeScript 3.5
7
+ // - ~/ts3.5/index.d.ts - Definitions specific to TypeScript 3.5 with assert pulled in
8
+
9
+ // Reference required types from the default lib:
10
+ /// <reference lib="es2018" />
11
+ /// <reference lib="esnext.asynciterable" />
12
+ /// <reference lib="esnext.intl" />
13
+ /// <reference lib="esnext.bigint" />
14
+
15
+ // Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
16
+ // tslint:disable-next-line:no-bad-reference
17
+ /// <reference path="../ts3.2/base.d.ts" />
18
+
19
+ // TypeScript 3.5-specific augmentations:
20
+ /// <reference path="wasi.d.ts" />
node/ts3.5/index.d.ts CHANGED
@@ -1,14 +1,8 @@
1
1
  // NOTE: These definitions support NodeJS and TypeScript 3.5.
2
+ // This is requried to enable typing assert in ts3.7 without causing errors
3
+ // Typically type modifiations should be made in base.d.ts instead of here
2
4
 
3
- // Reference required types from the default lib:
4
- /// <reference lib="es2018" />
5
- /// <reference lib="esnext.asynciterable" />
6
- /// <reference lib="esnext.intl" />
7
- /// <reference lib="esnext.bigint" />
5
+ /// <reference path="base.d.ts" />
8
6
 
9
- // Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
10
7
  // tslint:disable-next-line:no-bad-reference
11
- /// <reference path="../ts3.2/index.d.ts" />
12
-
13
- // TypeScript 3.5-specific augmentations:
14
- /// <reference path="wasi.d.ts" />
8
+ /// <reference path="../assert.d.ts" />
node/ts3.5/wasi.d.ts CHANGED
@@ -17,9 +17,7 @@ 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>;
23
21
 
24
22
  /**
25
23
  * By default, WASI applications terminate the Node.js
@@ -49,6 +47,6 @@ declare module 'wasi' {
49
47
  * should be passed as the `wasi_unstable` import during the instantiation of a
50
48
  * [`WebAssembly.Instance`][].
51
49
  */
52
- readonly wasiImport: { [key: string]: any }; // TODO: Narrow to DOM types
50
+ readonly wasiImport: NodeJS.Dict<any>; // TODO: Narrow to DOM types
53
51
  }
54
52
  }
node/ts3.7/assert.d.ts ADDED
@@ -0,0 +1,57 @@
1
+ declare module "assert" {
2
+ function assert(value: any, message?: string | Error): asserts value;
3
+ namespace assert {
4
+ class AssertionError implements Error {
5
+ name: string;
6
+ message: string;
7
+ actual: any;
8
+ expected: any;
9
+ operator: string;
10
+ generatedMessage: boolean;
11
+ code: 'ERR_ASSERTION';
12
+
13
+ constructor(options?: {
14
+ message?: string; actual?: any; expected?: any;
15
+ operator?: string; stackStartFn?: Function
16
+ });
17
+ }
18
+
19
+ type AssertPredicate = RegExp | (new() => object) | ((thrown: any) => boolean) | object | Error;
20
+
21
+ function fail(message?: string | Error): never;
22
+ /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
23
+ function fail(actual: any, expected: any, message?: string | Error, operator?: string, stackStartFn?: Function): never;
24
+ function ok(value: any, message?: string | Error): asserts value;
25
+ /** @deprecated since v9.9.0 - use strictEqual() instead. */
26
+ function equal(actual: any, expected: any, message?: string | Error): void;
27
+ /** @deprecated since v9.9.0 - use notStrictEqual() instead. */
28
+ function notEqual(actual: any, expected: any, message?: string | Error): void;
29
+ /** @deprecated since v9.9.0 - use deepStrictEqual() instead. */
30
+ function deepEqual(actual: any, expected: any, message?: string | Error): void;
31
+ /** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */
32
+ function notDeepEqual(actual: any, expected: any, message?: string | Error): void;
33
+ function strictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
34
+ function notStrictEqual(actual: any, expected: any, message?: string | Error): void;
35
+ function deepStrictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
36
+ function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void;
37
+
38
+ function throws(block: () => any, message?: string | Error): void;
39
+ function throws(block: () => any, error: AssertPredicate, message?: string | Error): void;
40
+ function doesNotThrow(block: () => any, message?: string | Error): void;
41
+ function doesNotThrow(block: () => any, error: RegExp | Function, message?: string | Error): void;
42
+
43
+ function ifError(value: any): asserts value is null | undefined;
44
+
45
+ function rejects(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
46
+ function rejects(block: (() => Promise<any>) | Promise<any>, error: AssertPredicate, message?: string | Error): Promise<void>;
47
+ function doesNotReject(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
48
+ function doesNotReject(block: (() => Promise<any>) | Promise<any>, error: RegExp | Function, message?: string | Error): Promise<void>;
49
+
50
+ function match(value: string, regExp: RegExp, message?: string | Error): void;
51
+ function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
52
+
53
+ const strict: typeof assert;
54
+ }
55
+
56
+ export = assert;
57
+ }
node/ts3.7/base.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ // NOTE: These definitions support NodeJS and TypeScript 3.7.
2
+
3
+ // NOTE: TypeScript version-specific augmentations can be found in the following paths:
4
+ // - ~/base.d.ts - Shared definitions common to all TypeScript versions
5
+ // - ~/index.d.ts - Definitions specific to TypeScript 2.1
6
+ // - ~/ts3.7/base.d.ts - Definitions specific to TypeScript 3.7
7
+ // - ~/ts3.7/index.d.ts - Definitions specific to TypeScript 3.7 with assert pulled in
8
+
9
+ // Reference required types from the default lib:
10
+ /// <reference lib="es2018" />
11
+ /// <reference lib="esnext.asynciterable" />
12
+ /// <reference lib="esnext.intl" />
13
+ /// <reference lib="esnext.bigint" />
14
+
15
+ // Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
16
+ // tslint:disable-next-line:no-bad-reference
17
+ /// <reference path="../ts3.5/base.d.ts" />
18
+
19
+ // TypeScript 3.7-specific augmentations:
20
+ /// <reference path="assert.d.ts" />
node/ts3.7/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ // NOTE: These definitions support NodeJS and TypeScript 3.7.
2
+ // This isn't strictly needed since 3.7 has the assert module, but this way we're consistent.
3
+ // Typically type modificatons should be made in base.d.ts instead of here
4
+
5
+ /// <reference path="base.d.ts" />
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.
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;