import { EventEmitter } from 'node: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; close?: string; onClose?: string; }; autostart?: boolean; timeout?: number; } interface Plugin { (server: context, options: O, done: (err?: Error) => void): unknown; } 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; /** Alias for {@linkcode Avvio.close} */ [Symbol.asyncDispose](): Promise; } // 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 | ((server: C) => 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