import { EventEmitter } from "events"; declare function avvio(done?: Function): avvio.Avvio; declare function avvio( instance: I, options?: avvio.Options, done?: Function ): avvio.Avvio; /** * Typescript cannot manage changes related to options "expose" * because undefined before runtime */ declare namespace avvio { type context = I extends null ? Avvio : mixedInstance; type mixedInstance = I & Server; interface Options { expose?: { use?: string; after?: string; ready?: string; }; autostart?: boolean; } interface Plugin { (server: context, options: O, done: (err?: Error) => void): void; } interface Server { use: Use; after: After; ready: Ready; close: Close; onClose: OnClose; } interface Avvio extends EventEmitter, Server { on(event: "start", listener: () => void): this; on(event: "preReady", listener: () => void): this; on(event: "close", listener: () => void): this; start(): this; toJSON(): Object; prettyPrint(): string; override: ( server: context, fn: Plugin, options: any ) => context; started: boolean; booted: boolean; } // Avvio methods interface After> { (fn: (err: Error) => void): C; (fn: (err: Error, done: Function) => void): C; (fn: (err: Error, context: C, done: Function) => void): C; } interface Use> { (fn: avvio.Plugin, options?: O): C; } interface Ready> { (): Promise; (callback: (err?: Error) => void): void; (callback: (err: Error, done: Function) => void): void; (callback: (err: Error, context: C, done: Function) => void): void; } interface Close> { (fn: (err: Error) => void): void; (fn: (err: Error, done: Function) => void): void; (fn: (err: Error, context: C, done: Function) => void): void; } interface OnClose> { (fn: (context: C, done: Function) => void): C; } } export = avvio;