@types/node 14.6.0 → 14.6.4

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.
Files changed (63) hide show
  1. node/README.md +2 -2
  2. node/assert.d.ts +10 -10
  3. node/base.d.ts +20 -41
  4. node/index.d.ts +4 -35
  5. node/package.json +9 -9
  6. node/{ts3.7 → ts3.1}/assert.d.ts +10 -10
  7. node/{async_hooks.d.ts → ts3.1/async_hooks.d.ts} +21 -27
  8. node/ts3.1/base.d.ts +42 -0
  9. node/{buffer.d.ts → ts3.1/buffer.d.ts} +0 -0
  10. node/{child_process.d.ts → ts3.1/child_process.d.ts} +0 -0
  11. node/{cluster.d.ts → ts3.1/cluster.d.ts} +0 -0
  12. node/{console.d.ts → ts3.1/console.d.ts} +0 -0
  13. node/{constants.d.ts → ts3.1/constants.d.ts} +0 -0
  14. node/{crypto.d.ts → ts3.1/crypto.d.ts} +47 -3
  15. node/{dgram.d.ts → ts3.1/dgram.d.ts} +0 -0
  16. node/{dns.d.ts → ts3.1/dns.d.ts} +0 -0
  17. node/{domain.d.ts → ts3.1/domain.d.ts} +0 -0
  18. node/{events.d.ts → ts3.1/events.d.ts} +0 -0
  19. node/{fs → ts3.1/fs}/promises.d.ts +0 -0
  20. node/{fs.d.ts → ts3.1/fs.d.ts} +0 -0
  21. node/{globals.d.ts → ts3.1/globals.d.ts} +0 -0
  22. node/{globals.global.d.ts → ts3.1/globals.global.d.ts} +0 -0
  23. node/{http.d.ts → ts3.1/http.d.ts} +0 -0
  24. node/{http2.d.ts → ts3.1/http2.d.ts} +0 -0
  25. node/{https.d.ts → ts3.1/https.d.ts} +0 -0
  26. node/ts3.1/index.d.ts +44 -0
  27. node/{inspector.d.ts → ts3.1/inspector.d.ts} +0 -0
  28. node/{module.d.ts → ts3.1/module.d.ts} +0 -0
  29. node/{net.d.ts → ts3.1/net.d.ts} +0 -0
  30. node/{os.d.ts → ts3.1/os.d.ts} +0 -0
  31. node/{path.d.ts → ts3.1/path.d.ts} +0 -0
  32. node/{perf_hooks.d.ts → ts3.1/perf_hooks.d.ts} +0 -0
  33. node/{process.d.ts → ts3.1/process.d.ts} +1 -1
  34. node/{punycode.d.ts → ts3.1/punycode.d.ts} +0 -0
  35. node/{querystring.d.ts → ts3.1/querystring.d.ts} +0 -0
  36. node/{readline.d.ts → ts3.1/readline.d.ts} +0 -0
  37. node/{repl.d.ts → ts3.1/repl.d.ts} +0 -0
  38. node/{stream.d.ts → ts3.1/stream.d.ts} +0 -0
  39. node/{string_decoder.d.ts → ts3.1/string_decoder.d.ts} +0 -0
  40. node/{timers.d.ts → ts3.1/timers.d.ts} +0 -0
  41. node/{tls.d.ts → ts3.1/tls.d.ts} +0 -0
  42. node/{trace_events.d.ts → ts3.1/trace_events.d.ts} +0 -0
  43. node/{tty.d.ts → ts3.1/tty.d.ts} +0 -0
  44. node/{url.d.ts → ts3.1/url.d.ts} +0 -0
  45. node/{util.d.ts → ts3.1/util.d.ts} +0 -0
  46. node/{v8.d.ts → ts3.1/v8.d.ts} +0 -0
  47. node/{vm.d.ts → ts3.1/vm.d.ts} +0 -0
  48. node/{worker_threads.d.ts → ts3.1/worker_threads.d.ts} +0 -0
  49. node/{zlib.d.ts → ts3.1/zlib.d.ts} +0 -0
  50. node/{ts3.2 → ts3.4}/base.d.ts +2 -2
  51. node/{ts3.2 → ts3.4}/fs.d.ts +1 -1
  52. node/{ts3.2 → ts3.4}/globals.d.ts +1 -1
  53. node/ts3.4/index.d.ts +12 -0
  54. node/{ts3.2 → ts3.4}/process.d.ts +1 -1
  55. node/{ts3.2 → ts3.4}/util.d.ts +1 -1
  56. node/{ts3.5 → ts3.6}/base.d.ts +1 -1
  57. node/{ts3.5 → ts3.6}/globals.global.d.ts +0 -0
  58. node/ts3.6/index.d.ts +8 -0
  59. node/{ts3.5 → ts3.6}/wasi.d.ts +0 -0
  60. node/ts3.2/index.d.ts +0 -12
  61. node/ts3.5/index.d.ts +0 -8
  62. node/ts3.7/base.d.ts +0 -20
  63. node/ts3.7/index.d.ts +0 -5
node/README.md CHANGED
@@ -8,9 +8,9 @@ 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, 17 Aug 2020 14:33:28 GMT
11
+ * Last updated: Thu, 03 Sep 2020 22:13:20 GMT
12
12
  * Dependencies: none
13
- * Global values: `Buffer`, `Symbol`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
13
+ * Global values: `Buffer`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`, `Symbol`
14
14
 
15
15
  # Credits
16
16
  These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alexander T.](https://github.com/a-tarasyuk), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Bruno Scheufler](https://github.com/brunoscheufler), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Flarna](https://github.com/Flarna), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Hoàng Văn Khải](https://github.com/KSXGitHub), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Jordi Oliveras Rovira](https://github.com/j-oliveras), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Minh Son Nguyen](https://github.com/nguymin4), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), and [Jason Kwok](https://github.com/JasonHK).
node/assert.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  declare module "assert" {
2
- function assert(value: any, message?: string | Error): void;
2
+ function assert(value: any, message?: string | Error): asserts value;
3
3
  namespace assert {
4
4
  class AssertionError implements Error {
5
5
  name: string;
@@ -19,20 +19,20 @@ declare module "assert" {
19
19
  type AssertPredicate = RegExp | (new() => object) | ((thrown: any) => boolean) | object | Error;
20
20
 
21
21
  function fail(message?: string | Error): never;
22
- /** @deprecated since v10.0.0 - use `fail([message])` or other assert functions instead. */
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
- function ok(value: any, message?: string | Error): void;
25
- /** @deprecated since v9.9.0 - use `strictEqual()` instead. */
24
+ function ok(value: any, message?: string | Error): asserts value;
25
+ /** @deprecated since v9.9.0 - use strictEqual() instead. */
26
26
  function equal(actual: any, expected: any, message?: string | Error): void;
27
- /** @deprecated since v9.9.0 - use `notStrictEqual()` instead. */
27
+ /** @deprecated since v9.9.0 - use notStrictEqual() instead. */
28
28
  function notEqual(actual: any, expected: any, message?: string | Error): void;
29
- /** @deprecated since v9.9.0 - use `deepStrictEqual()` instead. */
29
+ /** @deprecated since v9.9.0 - use deepStrictEqual() instead. */
30
30
  function deepEqual(actual: any, expected: any, message?: string | Error): void;
31
- /** @deprecated since v9.9.0 - use `notDeepStrictEqual()` instead. */
31
+ /** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */
32
32
  function notDeepEqual(actual: any, expected: any, message?: string | Error): void;
33
- function strictEqual(actual: any, expected: any, message?: string | Error): void;
33
+ function strictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
34
34
  function notStrictEqual(actual: any, expected: any, message?: string | Error): void;
35
- function deepStrictEqual(actual: any, expected: any, message?: string | Error): void;
35
+ function deepStrictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
36
36
  function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void;
37
37
 
38
38
  function throws(block: () => any, message?: string | Error): void;
@@ -40,7 +40,7 @@ declare module "assert" {
40
40
  function doesNotThrow(block: () => any, message?: string | Error): void;
41
41
  function doesNotThrow(block: () => any, error: RegExp | Function, message?: string | Error): void;
42
42
 
43
- function ifError(value: any): void;
43
+ function ifError(value: any): asserts value is null | undefined;
44
44
 
45
45
  function rejects(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
46
46
  function rejects(block: (() => Promise<any>) | Promise<any>, error: AssertPredicate, message?: string | Error): Promise<void>;
node/base.d.ts CHANGED
@@ -1,41 +1,20 @@
1
- // base definitions for all NodeJS modules that are not specific to any version of TypeScript
2
- /// <reference path="globals.d.ts" />
3
- /// <reference path="async_hooks.d.ts" />
4
- /// <reference path="buffer.d.ts" />
5
- /// <reference path="child_process.d.ts" />
6
- /// <reference path="cluster.d.ts" />
7
- /// <reference path="console.d.ts" />
8
- /// <reference path="constants.d.ts" />
9
- /// <reference path="crypto.d.ts" />
10
- /// <reference path="dgram.d.ts" />
11
- /// <reference path="dns.d.ts" />
12
- /// <reference path="domain.d.ts" />
13
- /// <reference path="events.d.ts" />
14
- /// <reference path="fs.d.ts" />
15
- /// <reference path="fs/promises.d.ts" />
16
- /// <reference path="http.d.ts" />
17
- /// <reference path="http2.d.ts" />
18
- /// <reference path="https.d.ts" />
19
- /// <reference path="inspector.d.ts" />
20
- /// <reference path="module.d.ts" />
21
- /// <reference path="net.d.ts" />
22
- /// <reference path="os.d.ts" />
23
- /// <reference path="path.d.ts" />
24
- /// <reference path="perf_hooks.d.ts" />
25
- /// <reference path="process.d.ts" />
26
- /// <reference path="punycode.d.ts" />
27
- /// <reference path="querystring.d.ts" />
28
- /// <reference path="readline.d.ts" />
29
- /// <reference path="repl.d.ts" />
30
- /// <reference path="stream.d.ts" />
31
- /// <reference path="string_decoder.d.ts" />
32
- /// <reference path="timers.d.ts" />
33
- /// <reference path="tls.d.ts" />
34
- /// <reference path="trace_events.d.ts" />
35
- /// <reference path="tty.d.ts" />
36
- /// <reference path="url.d.ts" />
37
- /// <reference path="util.d.ts" />
38
- /// <reference path="v8.d.ts" />
39
- /// <reference path="vm.d.ts" />
40
- /// <reference path="worker_threads.d.ts" />
41
- /// <reference path="zlib.d.ts" />
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.6/base.d.ts" />
18
+
19
+ // TypeScript 3.7-specific augmentations:
20
+ /// <reference path="assert.d.ts" />
node/index.d.ts CHANGED
@@ -45,7 +45,10 @@
45
45
  // Jason Kwok <https://github.com/JasonHK>
46
46
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
47
47
 
48
- // NOTE: These definitions support NodeJS and TypeScript 3.5.
48
+ // NOTE: These definitions support NodeJS and TypeScript 3.7.
49
+ // Typically type modifications should be made in base.d.ts instead of here
50
+
51
+ /// <reference path="base.d.ts" />
49
52
 
50
53
  // NOTE: TypeScript version-specific augmentations can be found in the following paths:
51
54
  // - ~/base.d.ts - Shared definitions common to all TypeScript versions
@@ -55,37 +58,3 @@
55
58
  // NOTE: Augmentations for TypeScript 3.5 and later should use individual files for overrides
56
59
  // within the respective ~/ts3.5 (or later) folder. However, this is disallowed for versions
57
60
  // prior to TypeScript 3.5, so the older definitions will be found here.
58
-
59
- // Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
60
- /// <reference path="base.d.ts" />
61
-
62
- // We can't include globals.global.d.ts in globals.d.ts, as it'll cause duplication errors in TypeScript 3.5+
63
- /// <reference path="globals.global.d.ts" />
64
-
65
- // We can't include assert.d.ts in base.d.ts, as it'll cause duplication errors in TypeScript 3.7+
66
- /// <reference path="assert.d.ts" />
67
-
68
- // Forward-declarations for needed types from es2015 and later (in case users are using `--lib es5`)
69
- // Empty interfaces are used here which merge fine with the real declarations in the lib XXX files
70
- // just to ensure the names are known and node typings can be used without importing these libs.
71
- // if someone really needs these types the libs need to be added via --lib or in tsconfig.json
72
- interface AsyncIterable<T> { }
73
- interface IterableIterator<T> { }
74
- interface AsyncIterableIterator<T> {}
75
- interface SymbolConstructor {
76
- readonly asyncIterator: symbol;
77
- }
78
- declare var Symbol: SymbolConstructor;
79
- // even this is just a forward declaration some properties are added otherwise
80
- // it would be allowed to pass anything to e.g. Buffer.from()
81
- interface SharedArrayBuffer {
82
- readonly byteLength: number;
83
- slice(begin?: number, end?: number): SharedArrayBuffer;
84
- }
85
-
86
- declare module "util" {
87
- namespace types {
88
- function isBigInt64Array(value: any): boolean;
89
- function isBigUint64Array(value: any): boolean;
90
- }
91
- }
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "14.6.0",
3
+ "version": "14.6.4",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -223,19 +223,19 @@
223
223
  "main": "",
224
224
  "types": "index.d.ts",
225
225
  "typesVersions": {
226
- ">=3.7.0-0": {
226
+ "<=3.1": {
227
227
  "*": [
228
- "ts3.7/*"
228
+ "ts3.1/*"
229
229
  ]
230
230
  },
231
- ">=3.5.0-0": {
231
+ "<=3.4": {
232
232
  "*": [
233
- "ts3.5/*"
233
+ "ts3.4/*"
234
234
  ]
235
235
  },
236
- ">=3.2.0-0": {
236
+ "<=3.6": {
237
237
  "*": [
238
- "ts3.2/*"
238
+ "ts3.6/*"
239
239
  ]
240
240
  }
241
241
  },
@@ -246,6 +246,6 @@
246
246
  },
247
247
  "scripts": {},
248
248
  "dependencies": {},
249
- "typesPublisherContentHash": "9d0f004e6461e52f8fa5badd6efa10f2dc7d2156363fcb7ca879e15a611c96f0",
250
- "typeScriptVersion": "3.0"
249
+ "typesPublisherContentHash": "5fc739401176088207c6f60e9d6b833ad5ae4b6a6edc1548b9665013878f8ac0",
250
+ "typeScriptVersion": "3.1"
251
251
  }
@@ -1,5 +1,5 @@
1
1
  declare module "assert" {
2
- function assert(value: any, message?: string | Error): asserts value;
2
+ function assert(value: any, message?: string | Error): void;
3
3
  namespace assert {
4
4
  class AssertionError implements Error {
5
5
  name: string;
@@ -19,20 +19,20 @@ declare module "assert" {
19
19
  type AssertPredicate = RegExp | (new() => object) | ((thrown: any) => boolean) | object | Error;
20
20
 
21
21
  function fail(message?: string | Error): never;
22
- /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
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
- function ok(value: any, message?: string | Error): asserts value;
25
- /** @deprecated since v9.9.0 - use strictEqual() instead. */
24
+ function ok(value: any, message?: string | Error): void;
25
+ /** @deprecated since v9.9.0 - use `strictEqual()` instead. */
26
26
  function equal(actual: any, expected: any, message?: string | Error): void;
27
- /** @deprecated since v9.9.0 - use notStrictEqual() instead. */
27
+ /** @deprecated since v9.9.0 - use `notStrictEqual()` instead. */
28
28
  function notEqual(actual: any, expected: any, message?: string | Error): void;
29
- /** @deprecated since v9.9.0 - use deepStrictEqual() instead. */
29
+ /** @deprecated since v9.9.0 - use `deepStrictEqual()` instead. */
30
30
  function deepEqual(actual: any, expected: any, message?: string | Error): void;
31
- /** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */
31
+ /** @deprecated since v9.9.0 - use `notDeepStrictEqual()` instead. */
32
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;
33
+ function strictEqual(actual: any, expected: any, message?: string | Error): void;
34
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;
35
+ function deepStrictEqual(actual: any, expected: any, message?: string | Error): void;
36
36
  function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void;
37
37
 
38
38
  function throws(block: () => any, message?: string | Error): void;
@@ -40,7 +40,7 @@ declare module "assert" {
40
40
  function doesNotThrow(block: () => any, message?: string | Error): void;
41
41
  function doesNotThrow(block: () => any, error: RegExp | Function, message?: string | Error): void;
42
42
 
43
- function ifError(value: any): asserts value is null | undefined;
43
+ function ifError(value: any): void;
44
44
 
45
45
  function rejects(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
46
46
  function rejects(block: (() => Promise<any>) | Promise<any>, error: AssertPredicate, message?: string | Error): Promise<void>;
@@ -152,8 +152,7 @@ declare module "async_hooks" {
152
152
  /**
153
153
  * This method disables the instance of `AsyncLocalStorage`. All subsequent calls
154
154
  * to `asyncLocalStorage.getStore()` will return `undefined` until
155
- * `asyncLocalStorage.run()` or `asyncLocalStorage.runSyncAndReturn()`
156
- * is called again.
155
+ * `asyncLocalStorage.run()` is called again.
157
156
  *
158
157
  * When calling `asyncLocalStorage.disable()`, all current contexts linked to the
159
158
  * instance will be exited.
@@ -169,45 +168,40 @@ declare module "async_hooks" {
169
168
  disable(): void;
170
169
 
171
170
  /**
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
171
+ * This method returns the current store. If this method is called outside of an
172
+ * asynchronous context initialized by calling `asyncLocalStorage.run`, it will
175
173
  * return `undefined`.
176
174
  */
177
175
  getStore(): T | undefined;
178
176
 
179
177
  /**
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.
178
+ * This methods runs a function synchronously within a context and return its
179
+ * return value. The store is not accessible outside of the callback function or
180
+ * the asynchronous operations created within the callback.
186
181
  *
187
- * The callback will be ran asynchronously. Optionally, arguments can be passed
188
- * to the function. They will be passed to the callback function.
182
+ * Optionally, arguments can be passed to the function. They will be passed to the
183
+ * callback function.
189
184
  *
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.
185
+ * I the callback function throws an error, it will be thrown by `run` too. The
186
+ * stacktrace will not be impacted by this call and the context will be exited.
193
187
  */
194
188
  // TODO: Apply generic vararg once available
195
- run(store: T, callback: (...args: any[]) => void, ...args: any[]): void;
189
+ run<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R;
196
190
 
197
191
  /**
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`.
192
+ * This methods runs a function synchronously outside of a context and return its
193
+ * return value. The store is not accessible within the callback function or the
194
+ * asynchronous operations created within the callback.
202
195
  *
203
- * The callback will be ran asynchronously. Optionally, arguments can be passed
204
- * to the function. They will be passed to the callback function.
196
+ * Optionally, arguments can be passed to the function. They will be passed to the
197
+ * callback function.
205
198
  *
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.
199
+ * If the callback function throws an error, it will be thrown by `exit` too. The
200
+ * stacktrace will not be impacted by this call and the context will be
201
+ * re-entered.
209
202
  */
210
- exit(callback: (...args: any[]) => void, ...args: any[]): void;
203
+ // TODO: Apply generic vararg once available
204
+ exit<R>(callback: (...args: any[]) => R, ...args: any[]): R;
211
205
 
212
206
  /**
213
207
  * Calling `asyncLocalStorage.enterWith(store)` will transition into the context
node/ts3.1/base.d.ts ADDED
@@ -0,0 +1,42 @@
1
+ // base definitions for all NodeJS modules that are not specific to any version of TypeScript
2
+
3
+ /// <reference path="globals.d.ts" />
4
+ /// <reference path="async_hooks.d.ts" />
5
+ /// <reference path="buffer.d.ts" />
6
+ /// <reference path="child_process.d.ts" />
7
+ /// <reference path="cluster.d.ts" />
8
+ /// <reference path="console.d.ts" />
9
+ /// <reference path="constants.d.ts" />
10
+ /// <reference path="crypto.d.ts" />
11
+ /// <reference path="dgram.d.ts" />
12
+ /// <reference path="dns.d.ts" />
13
+ /// <reference path="domain.d.ts" />
14
+ /// <reference path="events.d.ts" />
15
+ /// <reference path="fs.d.ts" />
16
+ /// <reference path="fs/promises.d.ts" />
17
+ /// <reference path="http.d.ts" />
18
+ /// <reference path="http2.d.ts" />
19
+ /// <reference path="https.d.ts" />
20
+ /// <reference path="inspector.d.ts" />
21
+ /// <reference path="module.d.ts" />
22
+ /// <reference path="net.d.ts" />
23
+ /// <reference path="os.d.ts" />
24
+ /// <reference path="path.d.ts" />
25
+ /// <reference path="perf_hooks.d.ts" />
26
+ /// <reference path="process.d.ts" />
27
+ /// <reference path="punycode.d.ts" />
28
+ /// <reference path="querystring.d.ts" />
29
+ /// <reference path="readline.d.ts" />
30
+ /// <reference path="repl.d.ts" />
31
+ /// <reference path="stream.d.ts" />
32
+ /// <reference path="string_decoder.d.ts" />
33
+ /// <reference path="timers.d.ts" />
34
+ /// <reference path="tls.d.ts" />
35
+ /// <reference path="trace_events.d.ts" />
36
+ /// <reference path="tty.d.ts" />
37
+ /// <reference path="url.d.ts" />
38
+ /// <reference path="util.d.ts" />
39
+ /// <reference path="v8.d.ts" />
40
+ /// <reference path="vm.d.ts" />
41
+ /// <reference path="worker_threads.d.ts" />
42
+ /// <reference path="zlib.d.ts" />
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -431,7 +431,7 @@ declare module "crypto" {
431
431
  /** @deprecated since v10.0.0 */
432
432
  const DEFAULT_ENCODING: BufferEncoding;
433
433
 
434
- type KeyType = 'rsa' | 'dsa' | 'ec' | 'ed25519';
434
+ type KeyType = 'rsa' | 'dsa' | 'ec' | 'ed25519' | 'x25519';
435
435
  type KeyFormat = 'pem' | 'der';
436
436
 
437
437
  interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
@@ -451,6 +451,12 @@ declare module "crypto" {
451
451
  */
452
452
  }
453
453
 
454
+ interface X25519KeyPairKeyObjectOptions {
455
+ /**
456
+ * No options.
457
+ */
458
+ }
459
+
454
460
  interface ECKeyPairKeyObjectOptions {
455
461
  /**
456
462
  * Name of the curve to use.
@@ -537,11 +543,21 @@ declare module "crypto" {
537
543
 
538
544
  interface ED25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
539
545
  publicKeyEncoding: {
540
- type: 'pkcs1' | 'spki';
546
+ type: 'spki';
541
547
  format: PubF;
542
548
  };
543
549
  privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
544
- type: 'sec1' | 'pkcs8';
550
+ type: 'pkcs8';
551
+ };
552
+ }
553
+
554
+ interface X25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
555
+ publicKeyEncoding: {
556
+ type: 'spki';
557
+ format: PubF;
558
+ };
559
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
560
+ type: 'pkcs8';
545
561
  };
546
562
  }
547
563
 
@@ -574,6 +590,12 @@ declare module "crypto" {
574
590
  function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
575
591
  function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
576
592
 
593
+ function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
594
+ function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
595
+ function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
596
+ function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
597
+ function generateKeyPairSync(type: 'x25519', options: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
598
+
577
599
  function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
578
600
  function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
579
601
  function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
@@ -598,6 +620,12 @@ declare module "crypto" {
598
620
  function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
599
621
  function generateKeyPair(type: 'ed25519', options: ED25519KeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
600
622
 
623
+ function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
624
+ function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
625
+ function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
626
+ function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
627
+ function generateKeyPair(type: 'x25519', options: X25519KeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
628
+
601
629
  namespace generateKeyPair {
602
630
  function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
603
631
  function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
@@ -622,6 +650,12 @@ declare module "crypto" {
622
650
  function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
623
651
  function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
624
652
  function __promisify__(type: "ed25519", options: ED25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
653
+
654
+ function __promisify__(type: "x25519", options: X25519KeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
655
+ function __promisify__(type: "x25519", options: X25519KeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
656
+ function __promisify__(type: "x25519", options: X25519KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
657
+ function __promisify__(type: "x25519", options: X25519KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
658
+ function __promisify__(type: "x25519", options: X25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
625
659
  }
626
660
 
627
661
  /**
@@ -646,4 +680,14 @@ declare module "crypto" {
646
680
  * passed to [`crypto.createPublicKey()`][].
647
681
  */
648
682
  function verify(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | VerifyKeyWithOptions, signature: NodeJS.ArrayBufferView): boolean;
683
+
684
+ /**
685
+ * Computes the Diffie-Hellman secret based on a privateKey and a publicKey.
686
+ * Both keys must have the same asymmetricKeyType, which must be one of
687
+ * 'dh' (for Diffie-Hellman), 'ec' (for ECDH), 'x448', or 'x25519' (for ECDH-ES).
688
+ */
689
+ function diffieHellman(options: {
690
+ privateKey: KeyObject;
691
+ publicKey: KeyObject
692
+ }): Buffer;
649
693
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
node/ts3.1/index.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ // NOTE: These definitions support NodeJS and TypeScript 3.1.
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.8
6
+ // - ~/ts3.5/index.d.ts - Definitions specific to TypeScript 3.5
7
+
8
+ // NOTE: Augmentations for TypeScript 3.5 and later should use individual files for overrides
9
+ // within the respective ~/ts3.5 (or later) folder. However, this is disallowed for versions
10
+ // prior to TypeScript 3.5, so the older definitions will be found here.
11
+
12
+ // Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
13
+ /// <reference path="base.d.ts" />
14
+
15
+ // We can't include globals.global.d.ts in globals.d.ts, as it'll cause duplication errors in TypeScript 3.5+
16
+ /// <reference path="globals.global.d.ts" />
17
+
18
+ // We can't include assert.d.ts in base.d.ts, as it'll cause duplication errors in TypeScript 3.7+
19
+ /// <reference path="assert.d.ts" />
20
+
21
+ // Forward-declarations for needed types from es2015 and later (in case users are using `--lib es5`)
22
+ // Empty interfaces are used here which merge fine with the real declarations in the lib XXX files
23
+ // just to ensure the names are known and node typings can be used without importing these libs.
24
+ // if someone really needs these types the libs need to be added via --lib or in tsconfig.json
25
+ interface AsyncIterable<T> { }
26
+ interface IterableIterator<T> { }
27
+ interface AsyncIterableIterator<T> {}
28
+ interface SymbolConstructor {
29
+ readonly asyncIterator: symbol;
30
+ }
31
+ declare var Symbol: SymbolConstructor;
32
+ // even this is just a forward declaration some properties are added otherwise
33
+ // it would be allowed to pass anything to e.g. Buffer.from()
34
+ interface SharedArrayBuffer {
35
+ readonly byteLength: number;
36
+ slice(begin?: number, end?: number): SharedArrayBuffer;
37
+ }
38
+
39
+ declare module "util" {
40
+ namespace types {
41
+ function isBigInt64Array(value: any): boolean;
42
+ function isBigUint64Array(value: any): boolean;
43
+ }
44
+ }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -32,7 +32,7 @@ declare module "process" {
32
32
  lts?: string;
33
33
  }
34
34
 
35
- interface ProcessVersions {
35
+ interface ProcessVersions extends Dict<string> {
36
36
  http_parser: string;
37
37
  node: string;
38
38
  v8: string;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- // NOTE: These definitions support NodeJS and TypeScript 3.2.
1
+ // NOTE: These definitions support NodeJS and TypeScript 3.2 - 3.4.
2
2
 
3
3
  // NOTE: TypeScript version-specific augmentations can be found in the following paths:
4
4
  // - ~/base.d.ts - Shared definitions common to all TypeScript versions
@@ -14,7 +14,7 @@
14
14
 
15
15
  // Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
16
16
  // tslint:disable-next-line:no-bad-reference
17
- /// <reference path="../base.d.ts" />
17
+ /// <reference path="../ts3.1/base.d.ts" />
18
18
 
19
19
  // TypeScript 3.2-specific augmentations:
20
20
  /// <reference path="fs.d.ts" />
@@ -1,5 +1,5 @@
1
1
  // tslint:disable-next-line:no-bad-reference
2
- /// <reference path="../fs.d.ts" />
2
+ /// <reference path="../ts3.1/fs.d.ts" />
3
3
 
4
4
  declare module 'fs' {
5
5
  interface BigIntStats extends StatsBase<bigint> {
@@ -1,5 +1,5 @@
1
1
  // tslint:disable-next-line:no-bad-reference
2
- /// <reference path="../globals.d.ts" />
2
+ /// <reference path="../ts3.1/globals.d.ts" />
3
3
 
4
4
  interface Buffer extends Uint8Array {
5
5
  readBigUInt64BE(offset?: number): bigint;
node/ts3.4/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ // NOTE: These definitions support NodeJS and TypeScript 3.2 - 3.4.
2
+ // This is required to enable globalThis support for global in ts3.5 without causing errors
3
+ // This is required to enable typing assert in ts3.7 without causing errors
4
+ // Typically type modifiations should be made in base.d.ts instead of here
5
+
6
+ /// <reference path="base.d.ts" />
7
+
8
+ // tslint:disable-next-line:no-bad-reference
9
+ /// <reference path="../ts3.1/assert.d.ts" />
10
+
11
+ // tslint:disable-next-line:no-bad-reference
12
+ /// <reference path="../ts3.1/globals.global.d.ts" />
@@ -1,5 +1,5 @@
1
1
  // tslint:disable-next-line:no-bad-reference
2
- /// <reference path="../process.d.ts" />
2
+ /// <reference path="../ts3.1/process.d.ts" />
3
3
 
4
4
  declare module 'process' {
5
5
  global {
@@ -1,5 +1,5 @@
1
1
  // tslint:disable-next-line:no-bad-reference
2
- /// <reference path="../util.d.ts" />
2
+ /// <reference path="../ts3.1/util.d.ts" />
3
3
 
4
4
  declare module "util" {
5
5
  namespace types {
@@ -14,7 +14,7 @@
14
14
 
15
15
  // Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
16
16
  // tslint:disable-next-line:no-bad-reference
17
- /// <reference path="../ts3.2/base.d.ts" />
17
+ /// <reference path="../ts3.4/base.d.ts" />
18
18
 
19
19
  // TypeScript 3.5-specific augmentations:
20
20
  /// <reference path="globals.global.d.ts" />
File without changes
node/ts3.6/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ // NOTE: These definitions support NodeJS and TypeScript 3.5 - 3.6.
2
+ // This is required to enable typing assert in ts3.7 without causing errors
3
+ // Typically type modifications should be made in base.d.ts instead of here
4
+
5
+ /// <reference path="base.d.ts" />
6
+
7
+ // tslint:disable-next-line:no-bad-reference
8
+ /// <reference path="../ts3.1/assert.d.ts" />
File without changes
node/ts3.2/index.d.ts DELETED
@@ -1,12 +0,0 @@
1
- // NOTE: These definitions support NodeJS and TypeScript 3.2.
2
- // This is requried to enable globalThis support for global in ts3.5 without causing errors
3
- // This is requried to enable typing assert in ts3.7 without causing errors
4
- // Typically type modifiations should be made in base.d.ts instead of here
5
-
6
- /// <reference path="base.d.ts" />
7
-
8
- // tslint:disable-next-line:no-bad-reference
9
- /// <reference path="../assert.d.ts" />
10
-
11
- // tslint:disable-next-line:no-bad-reference
12
- /// <reference path="../globals.global.d.ts" />
node/ts3.5/index.d.ts DELETED
@@ -1,8 +0,0 @@
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
4
-
5
- /// <reference path="base.d.ts" />
6
-
7
- // tslint:disable-next-line:no-bad-reference
8
- /// <reference path="../assert.d.ts" />
node/ts3.7/base.d.ts DELETED
@@ -1,20 +0,0 @@
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 DELETED
@@ -1,5 +0,0 @@
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" />