@types/node 16.18.24 → 16.18.25

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 v16.18/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v16.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 19 Apr 2023 23:02:50 GMT
11
+ * Last updated: Tue, 25 Apr 2023 21:32:49 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
14
14
 
@@ -144,7 +144,7 @@ declare namespace NodeJS {
144
144
  /**
145
145
  * Name of the script [if this function was defined in a script]
146
146
  */
147
- getFileName(): string | null;
147
+ getFileName(): string | undefined;
148
148
 
149
149
  /**
150
150
  * Current line number [if this function was defined in a script]
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "16.18.24",
3
+ "version": "16.18.25",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -227,6 +227,6 @@
227
227
  },
228
228
  "scripts": {},
229
229
  "dependencies": {},
230
- "typesPublisherContentHash": "66fec62786e1345b4a59957f39828e811ceda6deba2f3f3ff047861f14d06b41",
230
+ "typesPublisherContentHash": "6355bb568495bb14586f8a7ec585a0e613fc7cd7c626deab5e3381e4d59ffaa5",
231
231
  "typeScriptVersion": "4.3"
232
232
  }
@@ -372,6 +372,100 @@ declare module 'v8' {
372
372
  * @since v15.1.0, v12.22.0
373
373
  */
374
374
  function stopCoverage(): void;
375
+ /**
376
+ * Called when a promise is constructed. This does not mean that corresponding before/after events will occur, only that the possibility exists. This will
377
+ * happen if a promise is created without ever getting a continuation.
378
+ * @since v17.1.0, v16.14.0
379
+ * @param promise The promise being created.
380
+ * @param parent The promise continued from, if applicable.
381
+ */
382
+ interface Init {
383
+ (promise: Promise<unknown>, parent: Promise<unknown>): void;
384
+ }
385
+ /**
386
+ * Called before a promise continuation executes. This can be in the form of `then()`, `catch()`, or `finally()` handlers or an await resuming.
387
+ *
388
+ * The before callback will be called 0 to N times. The before callback will typically be called 0 times if no continuation was ever made for the promise.
389
+ * The before callback may be called many times in the case where many continuations have been made from the same promise.
390
+ * @since v17.1.0, v16.14.0
391
+ */
392
+ interface Before {
393
+ (promise: Promise<unknown>): void;
394
+ }
395
+ /**
396
+ * Called immediately after a promise continuation executes. This may be after a `then()`, `catch()`, or `finally()` handler or before an await after another await.
397
+ * @since v17.1.0, v16.14.0
398
+ */
399
+ interface After {
400
+ (promise: Promise<unknown>): void;
401
+ }
402
+ /**
403
+ * Called when the promise receives a resolution or rejection value. This may occur synchronously in the case of {@link Promise.resolve()} or
404
+ * {@link Promise.reject()}.
405
+ * @since v17.1.0, v16.14.0
406
+ */
407
+ interface Settled {
408
+ (promise: Promise<unknown>): void;
409
+ }
410
+ /**
411
+ * Key events in the lifetime of a promise have been categorized into four areas: creation of a promise, before/after a continuation handler is called or
412
+ * around an await, and when the promise resolves or rejects.
413
+ *
414
+ * Because promises are asynchronous resources whose lifecycle is tracked via the promise hooks mechanism, the `init()`, `before()`, `after()`, and
415
+ * `settled()` callbacks must not be async functions as they create more promises which would produce an infinite loop.
416
+ * @since v17.1.0, v16.14.0
417
+ */
418
+ interface HookCallbacks {
419
+ init?: Init;
420
+ before?: Before;
421
+ after?: After;
422
+ settled?: Settled;
423
+ }
424
+ interface PromiseHooks {
425
+ /**
426
+ * The `init` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
427
+ * @since v17.1.0, v16.14.0
428
+ * @param init The {@link Init | `init` callback} to call when a promise is created.
429
+ * @return Call to stop the hook.
430
+ */
431
+ onInit: (init: Init) => Function;
432
+ /**
433
+ * The `settled` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
434
+ * @since v17.1.0, v16.14.0
435
+ * @param settled The {@link Settled | `settled` callback} to call when a promise is created.
436
+ * @return Call to stop the hook.
437
+ */
438
+ onSettled: (settled: Settled) => Function;
439
+ /**
440
+ * The `before` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
441
+ * @since v17.1.0, v16.14.0
442
+ * @param before The {@link Before | `before` callback} to call before a promise continuation executes.
443
+ * @return Call to stop the hook.
444
+ */
445
+ onBefore: (before: Before) => Function;
446
+ /**
447
+ * The `after` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
448
+ * @since v17.1.0, v16.14.0
449
+ * @param after The {@link After | `after` callback} to call after a promise continuation executes.
450
+ * @return Call to stop the hook.
451
+ */
452
+ onAfter: (after: After) => Function;
453
+ /**
454
+ * Registers functions to be called for different lifetime events of each promise.
455
+ * The callbacks `init()`/`before()`/`after()`/`settled()` are called for the respective events during a promise's lifetime.
456
+ * All callbacks are optional. For example, if only promise creation needs to be tracked, then only the init callback needs to be passed.
457
+ * The hook callbacks must be plain functions. Providing async functions will throw as it would produce an infinite microtask loop.
458
+ * @since v17.1.0, v16.14.0
459
+ * @param callbacks The {@link HookCallbacks | Hook Callbacks} to register
460
+ * @return Used for disabling hooks
461
+ */
462
+ createHook: (callbacks: HookCallbacks) => Function;
463
+ }
464
+ /**
465
+ * The `promiseHooks` interface can be used to track promise lifecycle events.
466
+ * @since v17.1.0, v16.14.0
467
+ */
468
+ const promiseHooks: PromiseHooks;
375
469
  }
376
470
  declare module 'node:v8' {
377
471
  export * from 'v8';
node v16.18/v8.d.ts CHANGED
@@ -372,6 +372,100 @@ declare module 'v8' {
372
372
  * @since v15.1.0, v12.22.0
373
373
  */
374
374
  function stopCoverage(): void;
375
+ /**
376
+ * Called when a promise is constructed. This does not mean that corresponding before/after events will occur, only that the possibility exists. This will
377
+ * happen if a promise is created without ever getting a continuation.
378
+ * @since v17.1.0, v16.14.0
379
+ * @param promise The promise being created.
380
+ * @param parent The promise continued from, if applicable.
381
+ */
382
+ interface Init {
383
+ (promise: Promise<unknown>, parent: Promise<unknown>): void;
384
+ }
385
+ /**
386
+ * Called before a promise continuation executes. This can be in the form of `then()`, `catch()`, or `finally()` handlers or an await resuming.
387
+ *
388
+ * The before callback will be called 0 to N times. The before callback will typically be called 0 times if no continuation was ever made for the promise.
389
+ * The before callback may be called many times in the case where many continuations have been made from the same promise.
390
+ * @since v17.1.0, v16.14.0
391
+ */
392
+ interface Before {
393
+ (promise: Promise<unknown>): void;
394
+ }
395
+ /**
396
+ * Called immediately after a promise continuation executes. This may be after a `then()`, `catch()`, or `finally()` handler or before an await after another await.
397
+ * @since v17.1.0, v16.14.0
398
+ */
399
+ interface After {
400
+ (promise: Promise<unknown>): void;
401
+ }
402
+ /**
403
+ * Called when the promise receives a resolution or rejection value. This may occur synchronously in the case of {@link Promise.resolve()} or
404
+ * {@link Promise.reject()}.
405
+ * @since v17.1.0, v16.14.0
406
+ */
407
+ interface Settled {
408
+ (promise: Promise<unknown>): void;
409
+ }
410
+ /**
411
+ * Key events in the lifetime of a promise have been categorized into four areas: creation of a promise, before/after a continuation handler is called or
412
+ * around an await, and when the promise resolves or rejects.
413
+ *
414
+ * Because promises are asynchronous resources whose lifecycle is tracked via the promise hooks mechanism, the `init()`, `before()`, `after()`, and
415
+ * `settled()` callbacks must not be async functions as they create more promises which would produce an infinite loop.
416
+ * @since v17.1.0, v16.14.0
417
+ */
418
+ interface HookCallbacks {
419
+ init?: Init;
420
+ before?: Before;
421
+ after?: After;
422
+ settled?: Settled;
423
+ }
424
+ interface PromiseHooks {
425
+ /**
426
+ * The `init` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
427
+ * @since v17.1.0, v16.14.0
428
+ * @param init The {@link Init | `init` callback} to call when a promise is created.
429
+ * @return Call to stop the hook.
430
+ */
431
+ onInit: (init: Init) => Function;
432
+ /**
433
+ * The `settled` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
434
+ * @since v17.1.0, v16.14.0
435
+ * @param settled The {@link Settled | `settled` callback} to call when a promise is created.
436
+ * @return Call to stop the hook.
437
+ */
438
+ onSettled: (settled: Settled) => Function;
439
+ /**
440
+ * The `before` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
441
+ * @since v17.1.0, v16.14.0
442
+ * @param before The {@link Before | `before` callback} to call before a promise continuation executes.
443
+ * @return Call to stop the hook.
444
+ */
445
+ onBefore: (before: Before) => Function;
446
+ /**
447
+ * The `after` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
448
+ * @since v17.1.0, v16.14.0
449
+ * @param after The {@link After | `after` callback} to call after a promise continuation executes.
450
+ * @return Call to stop the hook.
451
+ */
452
+ onAfter: (after: After) => Function;
453
+ /**
454
+ * Registers functions to be called for different lifetime events of each promise.
455
+ * The callbacks `init()`/`before()`/`after()`/`settled()` are called for the respective events during a promise's lifetime.
456
+ * All callbacks are optional. For example, if only promise creation needs to be tracked, then only the init callback needs to be passed.
457
+ * The hook callbacks must be plain functions. Providing async functions will throw as it would produce an infinite microtask loop.
458
+ * @since v17.1.0, v16.14.0
459
+ * @param callbacks The {@link HookCallbacks | Hook Callbacks} to register
460
+ * @return Used for disabling hooks
461
+ */
462
+ createHook: (callbacks: HookCallbacks) => Function;
463
+ }
464
+ /**
465
+ * The `promiseHooks` interface can be used to track promise lifecycle events.
466
+ * @since v17.1.0, v16.14.0
467
+ */
468
+ const promiseHooks: PromiseHooks;
375
469
  }
376
470
  declare module 'node:v8' {
377
471
  export * from 'v8';