X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=%40types%2Fevents.d.ts;h=a0291fe8099abeea827af9d7a353871d8f0ee0a8;hb=c6c8dcf68b2d4e21215ce421c5632fe93e1e8a3e;hp=e74fe13840d4e2063b9959cf7ba61960320a6c4e;hpb=85126db3ff113e81dc8ad41ae045ba3ba2f334c5;p=poolifier.git diff --git a/@types/events.d.ts b/@types/events.d.ts index e74fe138..a0291fe8 100644 --- a/@types/events.d.ts +++ b/@types/events.d.ts @@ -14,29 +14,30 @@ declare module 'events' { EventEmitterOptions { /** * The type of async event. - * @default new.target.name + * @default new.target.name if instantiated as a child class. */ name?: string } /** - * Integrates `EventEmitter` with `AsyncResource` for `EventEmitters` that require + * Integrates `EventEmitter` with `AsyncResource` for `EventEmitter`s that require * manual async tracking. Specifically, all events emitted by instances of * `EventEmitterAsyncResource` will run within its async context. * * The EventEmitterAsyncResource class has the same methods and takes the * same options as EventEmitter and AsyncResource themselves. + * @throws if `options.name` is not provided when instantiated directly. + * @since v17.4.0, v16.14.0 */ export class EventEmitterAsyncResource extends EventEmitter { - constructor (options?: EventEmitterAsyncResourceOptions) + constructor (options: EventEmitterAsyncResourceOptions) /** * Call all `destroy` hooks. This should only ever be called once. An error will * be thrown if it is called more than once. This **must** be manually called. If * the resource is left to be collected by the GC then the `destroy` hooks will * never be called. - * @return A reference to `asyncResource`. */ - emitDestroy (): AsyncResource + emitDestroy (): void /** The unique asyncId assigned to the resource. */ readonly asyncId: number /** The same triggerAsyncId that is passed to the AsyncResource constructor. */