@types/node 16.18.55 → 16.18.57

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: Fri, 29 Sep 2023 15:35:13 GMT
11
+ * Last updated: Mon, 02 Oct 2023 21:06:31 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
14
14
 
node v16.18/events.d.ts CHANGED
@@ -35,6 +35,8 @@
35
35
  * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/events.js)
36
36
  */
37
37
  declare module "events" {
38
+ import { AsyncResource, AsyncResourceOptions } from "node:async_hooks";
39
+
38
40
  interface EventEmitterOptions {
39
41
  /**
40
42
  * Enables automatic capturing of promise rejection.
@@ -72,6 +74,9 @@ declare module "events" {
72
74
  */
73
75
  class EventEmitter {
74
76
  constructor(options?: EventEmitterOptions);
77
+
78
+ [EventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void;
79
+
75
80
  /**
76
81
  * Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
77
82
  * event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
@@ -314,10 +319,55 @@ declare module "events" {
314
319
  */
315
320
  signal?: AbortSignal | undefined;
316
321
  }
322
+
323
+ export interface EventEmitterReferencingAsyncResource extends AsyncResource {
324
+ readonly eventEmitter: EventEmitterAsyncResource;
325
+ }
326
+
327
+ export interface EventEmitterAsyncResourceOptions extends AsyncResourceOptions, EventEmitterOptions {
328
+ /**
329
+ * The type of async event, this is required when instantiating `EventEmitterAsyncResource`
330
+ * directly rather than as a child class.
331
+ * @default new.target.name if instantiated as a child class.
332
+ */
333
+ name?: string;
334
+ }
335
+
336
+ /**
337
+ * Integrates `EventEmitter` with `AsyncResource` for `EventEmitter`s that require
338
+ * manual async tracking. Specifically, all events emitted by instances of
339
+ * `EventEmitterAsyncResource` will run within its async context.
340
+ *
341
+ * The EventEmitterAsyncResource class has the same methods and takes the
342
+ * same options as EventEmitter and AsyncResource themselves.
343
+ * @throws if `options.name` is not provided when instantiated directly.
344
+ * @since v17.4.0, v16.14.0
345
+ */
346
+ export class EventEmitterAsyncResource extends EventEmitter {
347
+ /**
348
+ * @param options Only optional in child class.
349
+ */
350
+ constructor(options?: EventEmitterAsyncResourceOptions);
351
+ /**
352
+ * Call all destroy hooks. This should only ever be called once. An
353
+ * error will be thrown if it is called more than once. This must be
354
+ * manually called. If the resource is left to be collected by the GC then
355
+ * the destroy hooks will never be called.
356
+ */
357
+ emitDestroy(): void;
358
+ /** The unique asyncId assigned to the resource. */
359
+ readonly asyncId: number;
360
+ /** The same triggerAsyncId that is passed to the AsyncResource constructor. */
361
+ readonly triggerAsyncId: number;
362
+ /** The underlying AsyncResource */
363
+ readonly asyncResource: EventEmitterReferencingAsyncResource;
364
+ }
317
365
  }
318
366
  global {
319
367
  namespace NodeJS {
320
368
  interface EventEmitter {
369
+
370
+ [EventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void;
321
371
  /**
322
372
  * Alias for `emitter.on(eventName, listener)`.
323
373
  * @since v0.1.26
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "16.18.55",
3
+ "version": "16.18.57",
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": "5bfb542684c3f26af7cca44f82a2a5d72095e95c52e550b9274eb6d225217ad0",
230
+ "typesPublisherContentHash": "782a7d86f5efde22a58c72b8f27b51f3b33cf844f02eb7c77781c007dc86678c",
231
231
  "typeScriptVersion": "4.5"
232
232
  }
@@ -1,11 +1,11 @@
1
1
  declare module "stream/consumers" {
2
2
  import { Readable } from "node:stream";
3
3
  import { Blob as NodeBlob } from "node:buffer";
4
- function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Buffer>;
5
- function text(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<string>;
6
- function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<ArrayBuffer>;
7
- function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<NodeBlob>;
8
- function json(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<unknown>;
4
+ function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterable<any>): Promise<Buffer>;
5
+ function text(stream: NodeJS.ReadableStream | Readable | AsyncIterable<any>): Promise<string>;
6
+ function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterable<any>): Promise<ArrayBuffer>;
7
+ function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterable<any>): Promise<NodeBlob>;
8
+ function json(stream: NodeJS.ReadableStream | Readable | AsyncIterable<any>): Promise<unknown>;
9
9
  }
10
10
  declare module "node:stream/consumers" {
11
11
  export * from "stream/consumers";
@@ -1,11 +1,11 @@
1
1
  declare module "stream/consumers" {
2
2
  import { Readable } from "node:stream";
3
3
  import { Blob as NodeBlob } from "node:buffer";
4
- function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Buffer>;
5
- function text(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<string>;
6
- function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<ArrayBuffer>;
7
- function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<NodeBlob>;
8
- function json(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<unknown>;
4
+ function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterable<any>): Promise<Buffer>;
5
+ function text(stream: NodeJS.ReadableStream | Readable | AsyncIterable<any>): Promise<string>;
6
+ function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterable<any>): Promise<ArrayBuffer>;
7
+ function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterable<any>): Promise<NodeBlob>;
8
+ function json(stream: NodeJS.ReadableStream | Readable | AsyncIterable<any>): Promise<unknown>;
9
9
  }
10
10
  declare module "node:stream/consumers" {
11
11
  export * from "stream/consumers";