@types/node 18.19.12 → 18.19.14

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 v18.19/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v18.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 31 Jan 2024 19:35:04 GMT
11
+ * Last updated: Thu, 01 Feb 2024 17:35:23 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
node v18.19/net.d.ts CHANGED
@@ -18,8 +18,8 @@ declare module "net" {
18
18
  import * as dns from "node:dns";
19
19
  type LookupFunction = (
20
20
  hostname: string,
21
- options: dns.LookupOneOptions,
22
- callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
21
+ options: dns.LookupOptions,
22
+ callback: (err: NodeJS.ErrnoException | null, address: string | dns.LookupAddress[], family?: number) => void,
23
23
  ) => void;
24
24
  interface AddressInfo {
25
25
  address: string;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.19.12",
3
+ "version": "18.19.14",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -229,6 +229,6 @@
229
229
  "dependencies": {
230
230
  "undici-types": "~5.26.4"
231
231
  },
232
- "typesPublisherContentHash": "71fb1d45dfd1fd5ba9079d0bb44dce95e9f4d03bfbe06c27ebc51bac335e154b",
232
+ "typesPublisherContentHash": "a107bce01be23cf9af28a4245e86ac3acac0db904c8dff3b4693a62e1343d646",
233
233
  "typeScriptVersion": "4.6"
234
234
  }
@@ -3531,12 +3531,13 @@ declare module "crypto" {
3531
3531
  */
3532
3532
  disableEntropyCache?: boolean | undefined;
3533
3533
  }
3534
+ type UUID = `${string}-${string}-${string}-${string}-${string}`;
3534
3535
  /**
3535
3536
  * Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) version 4 UUID. The UUID is generated using a
3536
3537
  * cryptographic pseudorandom number generator.
3537
3538
  * @since v15.6.0, v14.17.0
3538
3539
  */
3539
- function randomUUID(options?: RandomUUIDOptions): string;
3540
+ function randomUUID(options?: RandomUUIDOptions): UUID;
3540
3541
  interface X509CheckOptions {
3541
3542
  /**
3542
3543
  * @default 'always'
@@ -4072,7 +4073,7 @@ declare module "crypto" {
4072
4073
  * The UUID is generated using a cryptographic pseudorandom number generator.
4073
4074
  * @since v16.7.0
4074
4075
  */
4075
- randomUUID(): string;
4076
+ randomUUID(): UUID;
4076
4077
  CryptoKey: CryptoKeyConstructor;
4077
4078
  }
4078
4079
  // This constructor throws ILLEGAL_CONSTRUCTOR so it should not be newable.
@@ -35,6 +35,8 @@
35
35
  * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/events.js)
36
36
  */
37
37
  declare module "events" {
38
+ import { AsyncResource, AsyncResourceOptions } from "node:async_hooks";
39
+
38
40
  // NOTE: This class is in the docs but is **not actually exported** by Node.
39
41
  // If https://github.com/nodejs/node/issues/39903 gets resolved and Node
40
42
  // actually starts exporting the class, uncomment below.
@@ -109,6 +111,9 @@ declare module "events" {
109
111
  */
110
112
  class EventEmitter {
111
113
  constructor(options?: EventEmitterOptions);
114
+
115
+ [EventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void;
116
+
112
117
  /**
113
118
  * Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
114
119
  * event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
@@ -415,10 +420,54 @@ declare module "events" {
415
420
  */
416
421
  signal?: AbortSignal | undefined;
417
422
  }
423
+
424
+ export interface EventEmitterReferencingAsyncResource extends AsyncResource {
425
+ readonly eventEmitter: EventEmitterAsyncResource;
426
+ }
427
+
428
+ export interface EventEmitterAsyncResourceOptions extends AsyncResourceOptions, EventEmitterOptions {
429
+ /**
430
+ * The type of async event, this is required when instantiating `EventEmitterAsyncResource`
431
+ * directly rather than as a child class.
432
+ * @default new.target.name if instantiated as a child class.
433
+ */
434
+ name?: string;
435
+ }
436
+
437
+ /**
438
+ * Integrates `EventEmitter` with `AsyncResource` for `EventEmitter`s that require
439
+ * manual async tracking. Specifically, all events emitted by instances of
440
+ * `EventEmitterAsyncResource` will run within its async context.
441
+ *
442
+ * The EventEmitterAsyncResource class has the same methods and takes the
443
+ * same options as EventEmitter and AsyncResource themselves.
444
+ * @throws if `options.name` is not provided when instantiated directly.
445
+ * @since v17.4.0, v16.14.0
446
+ */
447
+ export class EventEmitterAsyncResource extends EventEmitter {
448
+ /**
449
+ * @param options Only optional in child class.
450
+ */
451
+ constructor(options?: EventEmitterAsyncResourceOptions);
452
+ /**
453
+ * Call all destroy hooks. This should only ever be called once. An
454
+ * error will be thrown if it is called more than once. This must be
455
+ * manually called. If the resource is left to be collected by the GC then
456
+ * the destroy hooks will never be called.
457
+ */
458
+ emitDestroy(): void;
459
+ /** The unique asyncId assigned to the resource. */
460
+ readonly asyncId: number;
461
+ /** The same triggerAsyncId that is passed to the AsyncResource constructor. */
462
+ readonly triggerAsyncId: number;
463
+ /** The underlying AsyncResource */
464
+ readonly asyncResource: EventEmitterReferencingAsyncResource;
465
+ }
418
466
  }
419
467
  global {
420
468
  namespace NodeJS {
421
469
  interface EventEmitter {
470
+ [EventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void;
422
471
  /**
423
472
  * Alias for `emitter.on(eventName, listener)`.
424
473
  * @since v0.1.26
@@ -22,7 +22,7 @@
22
22
  * IN THE SOFTWARE.
23
23
  */
24
24
 
25
- // NOTE: These definitions support NodeJS and TypeScript 4.8 and earlier.
25
+ // NOTE: These definitions support NodeJS and TypeScript 4.9+.
26
26
 
27
27
  // Reference required types from the default lib:
28
28
  /// <reference lib="es2020" />
@@ -18,8 +18,8 @@ declare module "net" {
18
18
  import * as dns from "node:dns";
19
19
  type LookupFunction = (
20
20
  hostname: string,
21
- options: dns.LookupOneOptions,
22
- callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
21
+ options: dns.LookupOptions,
22
+ callback: (err: NodeJS.ErrnoException | null, address: string | dns.LookupAddress[], family?: number) => void,
23
23
  ) => void;
24
24
  interface AddressInfo {
25
25
  address: string;
@@ -30,7 +30,7 @@
30
30
  */
31
31
  declare module "perf_hooks" {
32
32
  import { AsyncResource } from "node:async_hooks";
33
- type EntryType = "node" | "mark" | "measure" | "gc" | "function" | "http2" | "http";
33
+ type EntryType = "node" | "mark" | "measure" | "gc" | "function" | "http2" | "http" | "dns";
34
34
  interface NodeGCPerformanceDetail {
35
35
  /**
36
36
  * When `performanceEntry.entryType` is equal to 'gc', `the performance.kind` property identifies
@@ -1544,7 +1544,7 @@ declare module "util" {
1544
1544
  /**
1545
1545
  * Returns an iterator over each of the name-value pairs in the parameters.
1546
1546
  */
1547
- entries(): IterableIterator<[string, string]>;
1547
+ entries(): IterableIterator<[name: string, value: string]>;
1548
1548
  /**
1549
1549
  * Returns the value of the first name-value pair whose name is `name`.
1550
1550
  * If there are no such pairs, `null` is returned.