fix: fix event emitter local types definition
[poolifier.git] / @types / events.d.ts
index 900377b45a4c4f3ffa71fab45c949fd1718d23c4..ae0f8f50b59ec40297da691c52860f11defacbef 100644 (file)
@@ -20,12 +20,14 @@ declare module 'events' {
   }
 
   /**
-   * 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)
@@ -34,15 +36,14 @@ declare module 'events' {
      * 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. */
-    get asyncId (): number
+    readonly asyncId: number
     /** The same triggerAsyncId that is passed to the AsyncResource constructor. */
-    get triggerAsyncId (): number
+    readonly triggerAsyncId: number
     /** The underlying AsyncResource */
-    get asyncResource (): AsyncResource & {
+    readonly asyncResource: AsyncResource & {
       readonly eventEmitter: EventEmitterAsyncResource
     }
   }