import Koa, { Next } from 'koa' import { Server } from 'http' import { Application as FeathersApplication, HookContext, Params, RouteLookup } from '@feathersjs/feathers' import '@feathersjs/authentication' export type ApplicationAddons = { server: Server listen(port?: number, ...args: any[]): Promise } export type Application = Omit & FeathersApplication & ApplicationAddons export type FeathersKoaContext = Koa.Context & { app: A } export type Middleware = (context: FeathersKoaContext, next: Next) => any declare module '@feathersjs/feathers/lib/declarations' { interface ServiceOptions { koa?: { before?: Middleware[] after?: Middleware[] composed?: Middleware } } } declare module 'koa' { interface ExtendableContext { feathers?: Partial lookup?: RouteLookup hook?: HookContext } }