@types/node 18.15.12 → 18.16.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/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: Wed, 19 Apr 2023 23:02:48 GMT
11
+ * Last updated: Sun, 23 Apr 2023 05:02:41 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
@@ -63,6 +63,7 @@ interface AbortSignal extends EventTarget {
63
63
  */
64
64
  readonly aborted: boolean;
65
65
  readonly reason: any;
66
+ onabort: null | ((this: AbortSignal, event: Event) => any);
66
67
  }
67
68
 
68
69
  declare var AbortController: typeof globalThis extends {onmessage: any; AbortController: infer T}
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.12",
3
+ "version": "18.16.0",
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": "073cca51adb608444e55491359ddfc342818394742589fd17722e68ed00ee4fa",
235
+ "typesPublisherContentHash": "a33ada7d817296d3a0955f57b75fdf38201a158b99b66db3bb81316dfddd470b",
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/globals.d.ts CHANGED
@@ -45,35 +45,42 @@ declare var gc: undefined | (() => void);
45
45
  // from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
46
46
  /** A controller object that allows you to abort one or more DOM requests as and when desired. */
47
47
  interface AbortController {
48
- /**
49
- * Returns the AbortSignal object associated with this object.
50
- */
51
-
52
- readonly signal: AbortSignal;
53
- /**
54
- * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
55
- */
56
- abort(reason?: any): void;
48
+ /**
49
+ * Returns the AbortSignal object associated with this object.
50
+ */
51
+
52
+ readonly signal: AbortSignal;
53
+ /**
54
+ * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
55
+ */
56
+ abort(reason?: any): void;
57
57
  }
58
58
 
59
59
  /** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
60
60
  interface AbortSignal extends EventTarget {
61
- /**
62
- * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
63
- */
64
- readonly aborted: boolean;
61
+ /**
62
+ * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
63
+ */
64
+ readonly aborted: boolean;
65
+ readonly reason: any;
66
+ onabort: null | ((this: AbortSignal, event: Event) => any);
65
67
  }
66
68
 
67
- declare var AbortController: {
68
- prototype: AbortController;
69
- new(): AbortController;
70
- };
71
-
72
- declare var AbortSignal: {
73
- prototype: AbortSignal;
74
- new(): AbortSignal;
75
- // TODO: Add abort() static
76
- };
69
+ declare var AbortController: typeof globalThis extends {onmessage: any; AbortController: infer T}
70
+ ? T
71
+ : {
72
+ prototype: AbortController;
73
+ new(): AbortController;
74
+ };
75
+
76
+ declare var AbortSignal: typeof globalThis extends {onmessage: any; AbortSignal: infer T}
77
+ ? T
78
+ : {
79
+ prototype: AbortSignal;
80
+ new(): AbortSignal;
81
+ abort(reason?: any): AbortSignal;
82
+ timeout(milliseconds: number): AbortSignal;
83
+ };
77
84
  //#endregion borrowed
78
85
 
79
86
  //#region ArrayLike.at()
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
@@ -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/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
  /**