import { Command } from './command'; import { IOutput } from './output'; export type Listener = | ((...args: P[]) => Promise) | ((...args: P[]) => R) | ((this: T, ...args: P[]) => Promise) | ((this: T, ...args: P[]) => R); export type EventTypes = { 'command.initialize.before': (command: Command) => void | Promise; 'command.initialize.after': (command: Command) => void | Promise; 'command.execute.before': (command: Command, options: any) => void | Promise; 'command.execute.after': (command: Command) => void | Promise; 'command.options.register': (command: Command) => void; 'output.formats.register': (output: IOutput) => void; }; export interface IEvents { on(event: E, listener: EventTypes[E]): void; emit(event: E, ...args: Parameters): Promise; }