class Applet { context: T; env: string; silent: boolean; stack: Array | Applet.ComposedMiddleware>; new(silent?: boolean, keys?: string | string[]); listeners?(event: string | symbol): Function[]; on?(event: string | symbol, listener: (...args: any[]) => void): this; emit?(event: string | symbol, ...args: any[]): boolean; use(...fns: Applet.Middleware[]): this; onerror(err: Error); callback(context: Record | Applet.ContextGenerator): Applet.HandleFunction; } declare namespace Applet { type NextFunction = () => Promise; type Middleware = (context: T, next: NextFunction) => any; type ComposedMiddleware = (context: T, next?: NextFunction) => Promise; type DoneFunction = (context: T) => any; type HandleFunction = (done: DoneFunction) => Promise; type ContextGenerator = (any) => Record | Applet.Context | any; interface Context { silent?: boolean; env?: string; [key: string]: any; } function compose(middleware: Array | ComposedMiddleware>): ComposedMiddleware; function only(obj: Record, keys: string | string[]): Record; const App = Applet; } export as namespace Applet; export = Applet;