@types/node 18.15.13 → 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.
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: Fri, 21 Apr 2023 02:32:45 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/async_hooks.d.ts CHANGED
@@ -319,16 +319,6 @@ declare module 'async_hooks' {
319
319
  */
320
320
  triggerAsyncId(): number;
321
321
  }
322
- interface AsyncLocalStorageOptions<T> {
323
- /**
324
- * Optional callback invoked before a store is propagated to a new async resource.
325
- * Returning `true` allows propagation, returning `false` avoids it. Default is to propagate always.
326
- * @param type The type of async event.
327
- * @param store The current store.
328
- * @since v18.13.0
329
- */
330
- onPropagate?: ((type: string, store: T) => boolean) | undefined;
331
- }
332
322
  /**
333
323
  * This class creates stores that stay coherent through asynchronous operations.
334
324
  *
@@ -378,8 +368,23 @@ declare module 'async_hooks' {
378
368
  * @since v13.10.0, v12.17.0
379
369
  */
380
370
  class AsyncLocalStorage<T> {
381
- constructor(options?: AsyncLocalStorageOptions<T>);
382
-
371
+ /**
372
+ * Binds the given function to the current execution context.
373
+ * @since v18.16.0
374
+ * @param fn The function to bind to the current execution context.
375
+ * @returns A new function that calls `fn` within the captured execution context.
376
+ */
377
+ static bind<Func extends (...args: any[]) => any>(fn: Func): Func & {
378
+ asyncResource: AsyncResource;
379
+ };
380
+ /**
381
+ * Captures the current execution context and returns a function that accepts a function as an argument.
382
+ * Whenever the returned function is called, it calls the function passed to it within the captured context.
383
+ * @since v18.16.0
384
+ */
385
+ static snapshot(): (<R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R) & {
386
+ asyncResource: AsyncResource;
387
+ };
383
388
  /**
384
389
  * Disables the instance of `AsyncLocalStorage`. All subsequent calls
385
390
  * to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
node/buffer.d.ts CHANGED
@@ -427,6 +427,14 @@ declare module 'buffer' {
427
427
  * @param totalLength Total length of the `Buffer` instances in `list` when concatenated.
428
428
  */
429
429
  concat(list: ReadonlyArray<Uint8Array>, totalLength?: number): Buffer;
430
+ /**
431
+ * Copies the underlying memory of `view` into a new `Buffer`.
432
+ * @since v18.16.0
433
+ * @param view The `TypedArray` to copy.
434
+ * @param offset The starting offset within `view`.
435
+ * @param length The number of elements from `view` to copy.
436
+ */
437
+ copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer;
430
438
  /**
431
439
  * Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of`Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
432
440
  *
node/events.d.ts CHANGED
@@ -610,10 +610,14 @@ declare module 'events' {
610
610
  emit(eventName: string | symbol, ...args: any[]): boolean;
611
611
  /**
612
612
  * Returns the number of listeners listening to the event named `eventName`.
613
+ *
614
+ * If `listener` is provided, it will return how many times the listener
615
+ * is found in the list of the listeners of the event.
613
616
  * @since v3.2.0
614
617
  * @param eventName The name of the event being listened for
618
+ * @param listener The event handler function
615
619
  */
616
- listenerCount(eventName: string | symbol): number;
620
+ listenerCount(eventName: string | symbol, listener?: Function): number;
617
621
  /**
618
622
  * Adds the `listener` function to the _beginning_ of the listeners array for the
619
623
  * event named `eventName`. No checks are made to see if the `listener` has
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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for non-npm package Node.js 18.15
1
+ // Type definitions for non-npm package Node.js 18.16
2
2
  // Project: https://nodejs.org/
3
3
  // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4
4
  // DefinitelyTyped <https://github.com/DefinitelyTyped>
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.15.13",
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": "6e44e22075a6a4c2d94c101dd844e06d49ef22f1b098d48c303504b25d812972",
235
+ "typesPublisherContentHash": "d3663b78bd3d78e553ddfd126c148f35e1fe8e6b19795a15ed31c5fed7562192",
236
236
  "typeScriptVersion": "4.3"
237
237
  }
node/tls.d.ts CHANGED
@@ -768,12 +768,9 @@ declare module 'tls' {
768
768
  */
769
769
  crl?: string | Buffer | Array<string | Buffer> | undefined;
770
770
  /**
771
- * Diffie Hellman parameters, required for Perfect Forward Secrecy. Use
772
- * openssl dhparam to create the parameters. The key length must be
773
- * greater than or equal to 1024 bits or else an error will be thrown.
774
- * Although 1024 bits is permissible, use 2048 bits or larger for
775
- * stronger security. If omitted or invalid, the parameters are
776
- * silently discarded and DHE ciphers will not be available.
771
+ * `'auto'` or custom Diffie-Hellman parameters, required for non-ECDHE perfect forward secrecy.
772
+ * If omitted or invalid, the parameters are silently discarded and DHE ciphers will not be available.
773
+ * ECDHE-based perfect forward secrecy will still be available.
777
774
  */
778
775
  dhparam?: string | Buffer | undefined;
779
776
  /**
@@ -319,16 +319,6 @@ declare module 'async_hooks' {
319
319
  */
320
320
  triggerAsyncId(): number;
321
321
  }
322
- interface AsyncLocalStorageOptions<T> {
323
- /**
324
- * Optional callback invoked before a store is propagated to a new async resource.
325
- * Returning `true` allows propagation, returning `false` avoids it. Default is to propagate always.
326
- * @param type The type of async event.
327
- * @param store The current store.
328
- * @since v18.13.0
329
- */
330
- onPropagate?: ((type: string, store: T) => boolean) | undefined;
331
- }
332
322
  /**
333
323
  * This class creates stores that stay coherent through asynchronous operations.
334
324
  *
@@ -378,8 +368,23 @@ declare module 'async_hooks' {
378
368
  * @since v13.10.0, v12.17.0
379
369
  */
380
370
  class AsyncLocalStorage<T> {
381
- constructor(options?: AsyncLocalStorageOptions<T>);
382
-
371
+ /**
372
+ * Binds the given function to the current execution context.
373
+ * @since v18.16.0
374
+ * @param fn The function to bind to the current execution context.
375
+ * @returns A new function that calls `fn` within the captured execution context.
376
+ */
377
+ static bind<Func extends (...args: any[]) => any>(fn: Func): Func & {
378
+ asyncResource: AsyncResource;
379
+ };
380
+ /**
381
+ * Captures the current execution context and returns a function that accepts a function as an argument.
382
+ * Whenever the returned function is called, it calls the function passed to it within the captured context.
383
+ * @since v18.16.0
384
+ */
385
+ static snapshot(): (<R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R) & {
386
+ asyncResource: AsyncResource;
387
+ };
383
388
  /**
384
389
  * Disables the instance of `AsyncLocalStorage`. All subsequent calls
385
390
  * to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
node/ts4.8/buffer.d.ts CHANGED
@@ -200,8 +200,7 @@ declare module 'buffer' {
200
200
  import { Blob as NodeBlob } from 'buffer';
201
201
  // This conditional type will be the existing global Blob in a browser, or
202
202
  // the copy below in a Node environment.
203
- type __Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : NodeBlob;
204
-
203
+ type __Blob = typeof globalThis extends { onmessage: any; Blob: infer T } ? T : NodeBlob;
205
204
  global {
206
205
  // Buffer class
207
206
  type BufferEncoding =
@@ -428,6 +427,14 @@ declare module 'buffer' {
428
427
  * @param totalLength Total length of the `Buffer` instances in `list` when concatenated.
429
428
  */
430
429
  concat(list: ReadonlyArray<Uint8Array>, totalLength?: number): Buffer;
430
+ /**
431
+ * Copies the underlying memory of `view` into a new `Buffer`.
432
+ * @since v18.16.0
433
+ * @param view The `TypedArray` to copy.
434
+ * @param offset The starting offset within `view`.
435
+ * @param length The number of elements from `view` to copy.
436
+ */
437
+ copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer;
431
438
  /**
432
439
  * Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of`Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
433
440
  *
node/ts4.8/events.d.ts CHANGED
@@ -610,10 +610,14 @@ declare module 'events' {
610
610
  emit(eventName: string | symbol, ...args: any[]): boolean;
611
611
  /**
612
612
  * Returns the number of listeners listening to the event named `eventName`.
613
+ *
614
+ * If `listener` is provided, it will return how many times the listener
615
+ * is found in the list of the listeners of the event.
613
616
  * @since v3.2.0
614
617
  * @param eventName The name of the event being listened for
618
+ * @param listener The event handler function
615
619
  */
616
- listenerCount(eventName: string | symbol): number;
620
+ listenerCount(eventName: string | symbol, listener?: Function): number;
617
621
  /**
618
622
  * Adds the `listener` function to the _beginning_ of the listeners array for the
619
623
  * event named `eventName`. No checks are made to see if the `listener` has
node/ts4.8/tls.d.ts CHANGED
@@ -768,12 +768,9 @@ declare module 'tls' {
768
768
  */
769
769
  crl?: string | Buffer | Array<string | Buffer> | undefined;
770
770
  /**
771
- * Diffie Hellman parameters, required for Perfect Forward Secrecy. Use
772
- * openssl dhparam to create the parameters. The key length must be
773
- * greater than or equal to 1024 bits or else an error will be thrown.
774
- * Although 1024 bits is permissible, use 2048 bits or larger for
775
- * stronger security. If omitted or invalid, the parameters are
776
- * silently discarded and DHE ciphers will not be available.
771
+ * `'auto'` or custom Diffie-Hellman parameters, required for non-ECDHE perfect forward secrecy.
772
+ * If omitted or invalid, the parameters are silently discarded and DHE ciphers will not be available.
773
+ * ECDHE-based perfect forward secrecy will still be available.
777
774
  */
778
775
  dhparam?: string | Buffer | undefined;
779
776
  /**
node/ts4.8/url.d.ts CHANGED
@@ -833,6 +833,11 @@ declare module 'url' {
833
833
  * ```
834
834
  */
835
835
  set(name: string, value: string): void;
836
+ /**
837
+ * The total number of parameter entries.
838
+ * @since v18.16.0
839
+ */
840
+ readonly size: number;
836
841
  /**
837
842
  * Sort all existing name-value pairs in-place by their names. Sorting is done
838
843
  * with a [stable sorting algorithm](https://en.wikipedia.org/wiki/Sorting_algorithm#Stability), so relative order between name-value pairs
node/ts4.8/util.d.ts CHANGED
@@ -225,6 +225,12 @@ declare module 'util' {
225
225
  * @returns The same AbortSignal
226
226
  */
227
227
  export function transferableAbortSignal(signal: AbortSignal): AbortSignal;
228
+ /**
229
+ * Listens to abort event on the provided `signal` and returns a promise that is fulfilled when the `signal` is aborted.
230
+ * If the passed `resource` is garbage collected before the `signal` is aborted, the returned promise shall remain pending indefinitely.
231
+ * @param resource Any non-null entity, reference to which is held weakly.
232
+ */
233
+ export function aborted(signal: AbortSignal, resource: any): Promise<void>;
228
234
  /**
229
235
  * The `util.inspect()` method returns a string representation of `object` that is
230
236
  * intended for debugging. The output of `util.inspect` may change at any time
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';
@@ -262,6 +262,12 @@ declare module 'worker_threads' {
262
262
  * @default true
263
263
  */
264
264
  trackUnmanagedFds?: boolean | undefined;
265
+ /**
266
+ * An optional `name` to be appended to the worker title
267
+ * for debuggin/identification purposes, making the final title as
268
+ * `[worker ${id}] ${name}`.
269
+ */
270
+ name?: string | undefined;
265
271
  }
266
272
  interface ResourceLimits {
267
273
  /**
node/url.d.ts CHANGED
@@ -833,6 +833,11 @@ declare module 'url' {
833
833
  * ```
834
834
  */
835
835
  set(name: string, value: string): void;
836
+ /**
837
+ * The total number of parameter entries.
838
+ * @since v18.16.0
839
+ */
840
+ readonly size: number;
836
841
  /**
837
842
  * Sort all existing name-value pairs in-place by their names. Sorting is done
838
843
  * with a [stable sorting algorithm](https://en.wikipedia.org/wiki/Sorting_algorithm#Stability), so relative order between name-value pairs
node/util.d.ts CHANGED
@@ -225,6 +225,12 @@ declare module 'util' {
225
225
  * @returns The same AbortSignal
226
226
  */
227
227
  export function transferableAbortSignal(signal: AbortSignal): AbortSignal;
228
+ /**
229
+ * Listens to abort event on the provided `signal` and returns a promise that is fulfilled when the `signal` is aborted.
230
+ * If the passed `resource` is garbage collected before the `signal` is aborted, the returned promise shall remain pending indefinitely.
231
+ * @param resource Any non-null entity, reference to which is held weakly.
232
+ */
233
+ export function aborted(signal: AbortSignal, resource: any): Promise<void>;
228
234
  /**
229
235
  * The `util.inspect()` method returns a string representation of `object` that is
230
236
  * intended for debugging. The output of `util.inspect` may change at any time
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';
node/worker_threads.d.ts CHANGED
@@ -262,6 +262,12 @@ declare module 'worker_threads' {
262
262
  * @default true
263
263
  */
264
264
  trackUnmanagedFds?: boolean | undefined;
265
+ /**
266
+ * An optional `name` to be appended to the worker title
267
+ * for debuggin/identification purposes, making the final title as
268
+ * `[worker ${id}] ${name}`.
269
+ */
270
+ name?: string | undefined;
265
271
  }
266
272
  interface ResourceLimits {
267
273
  /**