/** * Minimal type definitions for Express and Fastify middleware. * * These are defined locally to avoid requiring @types/express and @types/fastify * as dependencies for consumers who only use one framework. TypeScript's structural * typing ensures real Express/Fastify objects satisfy these minimal interfaces. */ export interface ExpressRequest { method: string; path: string; query: Record; } export interface ExpressResponse { status(code: number): this; send(body: unknown): this; sendStatus(code: number): this; } export type ExpressNextFunction = (err?: unknown) => void; export type ExpressRequestHandler = (req: ExpressRequest, res: ExpressResponse, next: ExpressNextFunction) => void | Promise; export interface FastifyRequest { query: T extends { Querystring: infer Q; } ? Q : Record; } export interface FastifyReply { status(code: number): this; type(contentType: string): this; send(payload?: unknown): this; } export type FastifyDoneCallback = (err?: Error) => void; export interface FastifyInstance { get(path: string, handler: (request: FastifyRequest, reply: FastifyReply) => Promise): void; } export type FastifyPluginCallback = (instance: FastifyInstance, options: Record, done: FastifyDoneCallback) => void;