@types/node 16.4.11 → 16.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
node/async_hooks.d.ts CHANGED
@@ -3,19 +3,19 @@
3
3
  * can be accessed using:
4
4
  *
5
5
  * ```js
6
- * const async_hooks = require('async_hooks');
6
+ * import async_hooks from 'async_hooks';
7
7
  * ```
8
8
  * @experimental
9
- * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/async_hooks.js)
9
+ * @see [source](https://github.com/nodejs/node/blob/v16.6.0/lib/async_hooks.js)
10
10
  */
11
11
  declare module 'async_hooks' {
12
12
  /**
13
13
  * ```js
14
- * const async_hooks = require('async_hooks');
14
+ * import { executionAsyncId } from 'async_hooks';
15
15
  *
16
- * console.log(async_hooks.executionAsyncId()); // 1 - bootstrap
16
+ * console.log(executionAsyncId()); // 1 - bootstrap
17
17
  * fs.open(path, 'r', (err, fd) => {
18
- * console.log(async_hooks.executionAsyncId()); // 6 - open()
18
+ * console.log(executionAsyncId()); // 6 - open()
19
19
  * });
20
20
  * ```
21
21
  *
@@ -51,11 +51,11 @@ declare module 'async_hooks' {
51
51
  * but having an object representing the top-level can be helpful.
52
52
  *
53
53
  * ```js
54
- * const { open } = require('fs');
55
- * const { executionAsyncId, executionAsyncResource } = require('async_hooks');
54
+ * import { open } from 'fs';
55
+ * import { executionAsyncId, executionAsyncResource } from 'async_hooks';
56
56
  *
57
57
  * console.log(executionAsyncId(), executionAsyncResource()); // 1 {}
58
- * open(__filename, 'r', (err, fd) => {
58
+ * open(new URL(import.meta.url), 'r', (err, fd) => {
59
59
  * console.log(executionAsyncId(), executionAsyncResource()); // 7 FSReqWrap
60
60
  * });
61
61
  * ```
@@ -64,12 +64,12 @@ declare module 'async_hooks' {
64
64
  * use of a tracking `Map` to store the metadata:
65
65
  *
66
66
  * ```js
67
- * const { createServer } = require('http');
68
- * const {
67
+ * import { createServer } from 'http';
68
+ * import {
69
69
  * executionAsyncId,
70
70
  * executionAsyncResource,
71
71
  * createHook
72
- * } = require('async_hooks');
72
+ * } from 'async_hooks';
73
73
  * const sym = Symbol('state'); // Private symbol to avoid pollution
74
74
  *
75
75
  * createHook({
@@ -167,9 +167,9 @@ declare module 'async_hooks' {
167
167
  * specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
168
168
  *
169
169
  * ```js
170
- * const async_hooks = require('async_hooks');
170
+ * import { createHook } from 'async_hooks';
171
171
  *
172
- * const asyncHook = async_hooks.createHook({
172
+ * const asyncHook = createHook({
173
173
  * init(asyncId, type, triggerAsyncId, resource) { },
174
174
  * destroy(asyncId) { }
175
175
  * });
@@ -223,7 +223,7 @@ declare module 'async_hooks' {
223
223
  * The following is an overview of the `AsyncResource` API.
224
224
  *
225
225
  * ```js
226
- * const { AsyncResource, executionAsyncId } = require('async_hooks');
226
+ * import { AsyncResource, executionAsyncId } from 'async_hooks';
227
227
  *
228
228
  * // AsyncResource() is meant to be extended. Instantiating a
229
229
  * // new AsyncResource() also triggers init. If triggerAsyncId is omitted then
@@ -331,8 +331,8 @@ declare module 'async_hooks' {
331
331
  * logged within each request.
332
332
  *
333
333
  * ```js
334
- * const http = require('http');
335
- * const { AsyncLocalStorage } = require('async_hooks');
334
+ * import http from 'http';
335
+ * import { AsyncLocalStorage } from 'async_hooks';
336
336
  *
337
337
  * const asyncLocalStorage = new AsyncLocalStorage();
338
338
  *
node/base.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  // - ~/ts3.7/index.d.ts - Definitions specific to TypeScript 3.7 with assert pulled in
8
8
 
9
9
  // Reference required types from the default lib:
10
- /// <reference lib="es2018" />
10
+ /// <reference lib="es2020" />
11
11
  /// <reference lib="esnext.asynciterable" />
12
12
  /// <reference lib="esnext.intl" />
13
13
  /// <reference lib="esnext.bigint" />