declare module 'telegram-mtproto' { type DC = { id: number host: string port: number } type ServerConfig = { dev?: boolean webogram?: boolean dcList?: Array } type PublicKey = { modulus: string exponent: string } type AppConfig = { debug?: boolean publicKeys?: Array storage?: AsyncStorage } type ApiConfig = { invokeWithLayer?: number layer ?: number initConnection ?: number api_id ?: number device_model ?: string system_version ?: string app_version ?: string lang_code ?: string } type Config = { server?: ServerConfig api?: ApiConfig app?: AppConfig schema?: object mtSchema?: object } type UpdatesManager = any interface ApiManagerInstance { readonly storage: AsyncStorage readonly updates: UpdatesManager (method: string, params?: object, options?: object): Promise setUserAuth(dc: number, userAuth: T): void on(event: string|Array, handler: Function) } interface ApiManager { new ({ server, api, app, schema, mtSchema }?: Config): ApiManagerInstance } export const ApiManager: ApiManager class ApiManagerClass { public readonly storage: AsyncStorage public setUserAuth(dc: number, userAuth: T): void public on(event: string|Array, handler: Function) } export interface AsyncStorage { get(key: string): Promise set(key: string, val: any): Promise remove(...keys: Array): Promise clear(): Promise<{}> } function MTProto({ server, api, app, schema, mtSchema }: Config): ApiManagerInstance export default MTProto }