@types/node 18.16.0 → 18.16.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.
Files changed (5) hide show
  1. node/README.md +1 -1
  2. node/globals.d.ts +1 -1
  3. node/package.json +2 -2
  4. node/ts4.8/v8.d.ts +94 -0
  5. node/v8.d.ts +94 -0
node/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.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Sun, 23 Apr 2023 05:02:41 GMT
11
+ * Last updated: Tue, 25 Apr 2023 21:32:47 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
14
14
 
node/globals.d.ts CHANGED
@@ -159,7 +159,7 @@ declare namespace NodeJS {
159
159
  /**
160
160
  * Name of the script [if this function was defined in a script]
161
161
  */
162
- getFileName(): string | null;
162
+ getFileName(): string | undefined;
163
163
 
164
164
  /**
165
165
  * Current line number [if this function was defined in a script]
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.16.0",
3
+ "version": "18.16.1",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -232,6 +232,6 @@
232
232
  },
233
233
  "scripts": {},
234
234
  "dependencies": {},
235
- "typesPublisherContentHash": "a33ada7d817296d3a0955f57b75fdf38201a158b99b66db3bb81316dfddd470b",
235
+ "typesPublisherContentHash": "d3663b78bd3d78e553ddfd126c148f35e1fe8e6b19795a15ed31c5fed7562192",
236
236
  "typeScriptVersion": "4.3"
237
237
  }
node/ts4.8/v8.d.ts CHANGED
@@ -441,6 +441,100 @@ declare module 'v8' {
441
441
  spaceAvailableSize: number;
442
442
  physicalSpaceSize: number;
443
443
  }
444
+ /**
445
+ * Called when a promise is constructed. This does not mean that corresponding before/after events will occur, only that the possibility exists. This will
446
+ * happen if a promise is created without ever getting a continuation.
447
+ * @since v17.1.0, v16.14.0
448
+ * @param promise The promise being created.
449
+ * @param parent The promise continued from, if applicable.
450
+ */
451
+ interface Init {
452
+ (promise: Promise<unknown>, parent: Promise<unknown>): void;
453
+ }
454
+ /**
455
+ * Called before a promise continuation executes. This can be in the form of `then()`, `catch()`, or `finally()` handlers or an await resuming.
456
+ *
457
+ * 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.
458
+ * The before callback may be called many times in the case where many continuations have been made from the same promise.
459
+ * @since v17.1.0, v16.14.0
460
+ */
461
+ interface Before {
462
+ (promise: Promise<unknown>): void;
463
+ }
464
+ /**
465
+ * Called immediately after a promise continuation executes. This may be after a `then()`, `catch()`, or `finally()` handler or before an await after another await.
466
+ * @since v17.1.0, v16.14.0
467
+ */
468
+ interface After {
469
+ (promise: Promise<unknown>): void;
470
+ }
471
+ /**
472
+ * Called when the promise receives a resolution or rejection value. This may occur synchronously in the case of {@link Promise.resolve()} or
473
+ * {@link Promise.reject()}.
474
+ * @since v17.1.0, v16.14.0
475
+ */
476
+ interface Settled {
477
+ (promise: Promise<unknown>): void;
478
+ }
479
+ /**
480
+ * 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
481
+ * around an await, and when the promise resolves or rejects.
482
+ *
483
+ * Because promises are asynchronous resources whose lifecycle is tracked via the promise hooks mechanism, the `init()`, `before()`, `after()`, and
484
+ * `settled()` callbacks must not be async functions as they create more promises which would produce an infinite loop.
485
+ * @since v17.1.0, v16.14.0
486
+ */
487
+ interface HookCallbacks {
488
+ init?: Init;
489
+ before?: Before;
490
+ after?: After;
491
+ settled?: Settled;
492
+ }
493
+ interface PromiseHooks {
494
+ /**
495
+ * The `init` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
496
+ * @since v17.1.0, v16.14.0
497
+ * @param init The {@link Init | `init` callback} to call when a promise is created.
498
+ * @return Call to stop the hook.
499
+ */
500
+ onInit: (init: Init) => Function;
501
+ /**
502
+ * The `settled` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
503
+ * @since v17.1.0, v16.14.0
504
+ * @param settled The {@link Settled | `settled` callback} to call when a promise is created.
505
+ * @return Call to stop the hook.
506
+ */
507
+ onSettled: (settled: Settled) => Function;
508
+ /**
509
+ * The `before` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
510
+ * @since v17.1.0, v16.14.0
511
+ * @param before The {@link Before | `before` callback} to call before a promise continuation executes.
512
+ * @return Call to stop the hook.
513
+ */
514
+ onBefore: (before: Before) => Function;
515
+ /**
516
+ * The `after` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
517
+ * @since v17.1.0, v16.14.0
518
+ * @param after The {@link After | `after` callback} to call after a promise continuation executes.
519
+ * @return Call to stop the hook.
520
+ */
521
+ onAfter: (after: After) => Function;
522
+ /**
523
+ * Registers functions to be called for different lifetime events of each promise.
524
+ * The callbacks `init()`/`before()`/`after()`/`settled()` are called for the respective events during a promise's lifetime.
525
+ * All callbacks are optional. For example, if only promise creation needs to be tracked, then only the init callback needs to be passed.
526
+ * The hook callbacks must be plain functions. Providing async functions will throw as it would produce an infinite microtask loop.
527
+ * @since v17.1.0, v16.14.0
528
+ * @param callbacks The {@link HookCallbacks | Hook Callbacks} to register
529
+ * @return Used for disabling hooks
530
+ */
531
+ createHook: (callbacks: HookCallbacks) => Function;
532
+ }
533
+ /**
534
+ * The `promiseHooks` interface can be used to track promise lifecycle events.
535
+ * @since v17.1.0, v16.14.0
536
+ */
537
+ const promiseHooks: PromiseHooks;
444
538
  }
445
539
  declare module 'node:v8' {
446
540
  export * from 'v8';
node/v8.d.ts CHANGED
@@ -441,6 +441,100 @@ declare module 'v8' {
441
441
  spaceAvailableSize: number;
442
442
  physicalSpaceSize: number;
443
443
  }
444
+ /**
445
+ * Called when a promise is constructed. This does not mean that corresponding before/after events will occur, only that the possibility exists. This will
446
+ * happen if a promise is created without ever getting a continuation.
447
+ * @since v17.1.0, v16.14.0
448
+ * @param promise The promise being created.
449
+ * @param parent The promise continued from, if applicable.
450
+ */
451
+ interface Init {
452
+ (promise: Promise<unknown>, parent: Promise<unknown>): void;
453
+ }
454
+ /**
455
+ * Called before a promise continuation executes. This can be in the form of `then()`, `catch()`, or `finally()` handlers or an await resuming.
456
+ *
457
+ * 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.
458
+ * The before callback may be called many times in the case where many continuations have been made from the same promise.
459
+ * @since v17.1.0, v16.14.0
460
+ */
461
+ interface Before {
462
+ (promise: Promise<unknown>): void;
463
+ }
464
+ /**
465
+ * Called immediately after a promise continuation executes. This may be after a `then()`, `catch()`, or `finally()` handler or before an await after another await.
466
+ * @since v17.1.0, v16.14.0
467
+ */
468
+ interface After {
469
+ (promise: Promise<unknown>): void;
470
+ }
471
+ /**
472
+ * Called when the promise receives a resolution or rejection value. This may occur synchronously in the case of {@link Promise.resolve()} or
473
+ * {@link Promise.reject()}.
474
+ * @since v17.1.0, v16.14.0
475
+ */
476
+ interface Settled {
477
+ (promise: Promise<unknown>): void;
478
+ }
479
+ /**
480
+ * 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
481
+ * around an await, and when the promise resolves or rejects.
482
+ *
483
+ * Because promises are asynchronous resources whose lifecycle is tracked via the promise hooks mechanism, the `init()`, `before()`, `after()`, and
484
+ * `settled()` callbacks must not be async functions as they create more promises which would produce an infinite loop.
485
+ * @since v17.1.0, v16.14.0
486
+ */
487
+ interface HookCallbacks {
488
+ init?: Init;
489
+ before?: Before;
490
+ after?: After;
491
+ settled?: Settled;
492
+ }
493
+ interface PromiseHooks {
494
+ /**
495
+ * The `init` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
496
+ * @since v17.1.0, v16.14.0
497
+ * @param init The {@link Init | `init` callback} to call when a promise is created.
498
+ * @return Call to stop the hook.
499
+ */
500
+ onInit: (init: Init) => Function;
501
+ /**
502
+ * The `settled` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
503
+ * @since v17.1.0, v16.14.0
504
+ * @param settled The {@link Settled | `settled` callback} to call when a promise is created.
505
+ * @return Call to stop the hook.
506
+ */
507
+ onSettled: (settled: Settled) => Function;
508
+ /**
509
+ * The `before` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
510
+ * @since v17.1.0, v16.14.0
511
+ * @param before The {@link Before | `before` callback} to call before a promise continuation executes.
512
+ * @return Call to stop the hook.
513
+ */
514
+ onBefore: (before: Before) => Function;
515
+ /**
516
+ * The `after` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
517
+ * @since v17.1.0, v16.14.0
518
+ * @param after The {@link After | `after` callback} to call after a promise continuation executes.
519
+ * @return Call to stop the hook.
520
+ */
521
+ onAfter: (after: After) => Function;
522
+ /**
523
+ * Registers functions to be called for different lifetime events of each promise.
524
+ * The callbacks `init()`/`before()`/`after()`/`settled()` are called for the respective events during a promise's lifetime.
525
+ * All callbacks are optional. For example, if only promise creation needs to be tracked, then only the init callback needs to be passed.
526
+ * The hook callbacks must be plain functions. Providing async functions will throw as it would produce an infinite microtask loop.
527
+ * @since v17.1.0, v16.14.0
528
+ * @param callbacks The {@link HookCallbacks | Hook Callbacks} to register
529
+ * @return Used for disabling hooks
530
+ */
531
+ createHook: (callbacks: HookCallbacks) => Function;
532
+ }
533
+ /**
534
+ * The `promiseHooks` interface can be used to track promise lifecycle events.
535
+ * @since v17.1.0, v16.14.0
536
+ */
537
+ const promiseHooks: PromiseHooks;
444
538
  }
445
539
  declare module 'node:v8' {
446
540
  export * from 'v8';