@types/node 18.18.1 → 18.18.2
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.18/README.md +1 -1
- node v18.18/events.d.ts +51 -0
- node v18.18/package.json +2 -2
node v18.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/v18.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Mon, 02 Oct 2023 20:06:22 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
|
|
14
14
|
|
node v18.18/events.d.ts
CHANGED
|
@@ -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,10 @@ 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
|
+
|
|
117
|
+
|
|
112
118
|
/**
|
|
113
119
|
* Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
|
|
114
120
|
* event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
|
|
@@ -415,10 +421,55 @@ declare module "events" {
|
|
|
415
421
|
*/
|
|
416
422
|
signal?: AbortSignal | undefined;
|
|
417
423
|
}
|
|
424
|
+
|
|
425
|
+
export interface EventEmitterReferencingAsyncResource extends AsyncResource {
|
|
426
|
+
readonly eventEmitter: EventEmitterAsyncResource;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
export interface EventEmitterAsyncResourceOptions extends AsyncResourceOptions, EventEmitterOptions {
|
|
430
|
+
/**
|
|
431
|
+
* The type of async event, this is required when instantiating `EventEmitterAsyncResource`
|
|
432
|
+
* directly rather than as a child class.
|
|
433
|
+
* @default new.target.name if instantiated as a child class.
|
|
434
|
+
*/
|
|
435
|
+
name?: string;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Integrates `EventEmitter` with `AsyncResource` for `EventEmitter`s that require
|
|
440
|
+
* manual async tracking. Specifically, all events emitted by instances of
|
|
441
|
+
* `EventEmitterAsyncResource` will run within its async context.
|
|
442
|
+
*
|
|
443
|
+
* The EventEmitterAsyncResource class has the same methods and takes the
|
|
444
|
+
* same options as EventEmitter and AsyncResource themselves.
|
|
445
|
+
* @throws if `options.name` is not provided when instantiated directly.
|
|
446
|
+
* @since v17.4.0, v16.14.0
|
|
447
|
+
*/
|
|
448
|
+
export class EventEmitterAsyncResource extends EventEmitter {
|
|
449
|
+
/**
|
|
450
|
+
* @param options Only optional in child class.
|
|
451
|
+
*/
|
|
452
|
+
constructor(options?: EventEmitterAsyncResourceOptions);
|
|
453
|
+
/**
|
|
454
|
+
* Call all destroy hooks. This should only ever be called once. An
|
|
455
|
+
* error will be thrown if it is called more than once. This must be
|
|
456
|
+
* manually called. If the resource is left to be collected by the GC then
|
|
457
|
+
* the destroy hooks will never be called.
|
|
458
|
+
*/
|
|
459
|
+
emitDestroy(): void;
|
|
460
|
+
/** The unique asyncId assigned to the resource. */
|
|
461
|
+
readonly asyncId: number;
|
|
462
|
+
/** The same triggerAsyncId that is passed to the AsyncResource constructor. */
|
|
463
|
+
readonly triggerAsyncId: number;
|
|
464
|
+
/** The underlying AsyncResource */
|
|
465
|
+
readonly asyncResource: EventEmitterReferencingAsyncResource;
|
|
466
|
+
}
|
|
418
467
|
}
|
|
419
468
|
global {
|
|
420
469
|
namespace NodeJS {
|
|
421
470
|
interface EventEmitter {
|
|
471
|
+
|
|
472
|
+
[EventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void;
|
|
422
473
|
/**
|
|
423
474
|
* Alias for `emitter.on(eventName, listener)`.
|
|
424
475
|
* @since v0.1.26
|
node v18.18/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "18.18.
|
|
3
|
+
"version": "18.18.2",
|
|
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": "
|
|
235
|
+
"typesPublisherContentHash": "2b2f05b7fa46e7d87d9302eaa9e49acaf99d87216082180c2504c0aa1b6055b4",
|
|
236
236
|
"typeScriptVersion": "4.5"
|
|
237
237
|
}
|