Type Alias TypedEventEmitter<T>Category

TypedEventEmitter<T>: Record<string, unknown> & _BaseTypedEventEmitter<T & _BuiltInEvents<T>>

A type-checked EventEmitter.

Type Parameters

  • T extends EventListeners = Record<never, never>

    The event names and listener signatures

import { EventEmitter } from 'events';

type Events = {
success: () => void;
error: (error: Error) => void;
};

class TypedClass extends (EventEmitter as new () => TypedEventEmitter<Events>) {}

Typed EventEmitter