type EventHandler, Key extends keyof Events> = (payload: Events[Key]) => void; type EventBus> = { /** * Subscribe to an event * * @param event - The event name to subscribe to * @param handler - The callback function to execute when the event is dispatched * @param opts - Optional configuration * @param opts.notify - If true and the event was previously dispatched, handler will be called immediately with the latest payload * @returns void */ on: (event: Event, handler: EventHandler, opts?: { notify?: boolean; }) => void; /** * Publish an event with a payload * Triggers all registered handlers for the event * * @param event - The event name to publish * @param payload - The data to pass to event handlers * @returns void */ emit: (event: Event, payload: Events[Event]) => void; off: (event: Event, handler?: EventHandler) => void; getListeners: (event: Event) => Array<(...args: any[]) => void>; }; declare const createEventBus: >() => EventBus; export { createEventBus };