declare type Callback = (...args: ArgsType) => K; declare type ArgsType = T extends Array ? T : Array; declare class SyncHook { type: string; listeners: Set>; constructor(type?: string); on(fn: Callback): void; once(fn: Callback): void; emit(...data: ArgsType): void; remove(fn: Callback): boolean; removeAll(): void; } declare type CallbackReturnType$1 = void | false | Promise; declare class AsyncHook extends SyncHook> { emit(...data: ArgsType): Promise; } declare class SyncWaterfallHook> extends SyncHook<[ T ], T> { onerror: (errMsg: string | Error) => void; constructor(type: string); emit(data: T): T; } declare type CallbackReturnType = T | false | Promise; declare class AsyncWaterfallHook> extends SyncHook<[ T ], CallbackReturnType> { onerror: (errMsg: string | Error) => void; constructor(type: string); emit(data: T): Promise; } declare type Plugin> = { [k in keyof T]?: Parameters[0]; } & { name: string; version?: string; }; declare class PluginSystem> { lifecycle: T; lifecycleKeys: Array; registerPlugins: Record>; constructor(lifecycle: T); usePlugin(plugin: Plugin): void; removePlugin(pluginName: string): void; inherit>({ lifecycle, registerPlugins }: T): this & T; } export { AsyncHook, AsyncWaterfallHook, Plugin, PluginSystem, SyncHook, SyncWaterfallHook };