/** * AsyncWrapper * * Unified error handling * Automatically wraps async handlers to catch Promise rejections */ import { RequestHandler } from '../types/index'; /** * Wrap async handler to automatically catch errors * * @param fn - Async handler function * @returns Wrapped handler * * @example * ```typescript * app.get('/users/:id', asyncWrapper(async (req, res) => { * const user = await db.findUser(req.params.id) // Error can occur * res.json(user) * })) * ``` * * @example * ```typescript * // No try-catch needed! * app.get('/users/:id', async (req, res) => { * const user = await db.findUser(req.params.id) * res.json(user) * }) * ``` */ export declare function asyncWrapper(fn: RequestHandler): RequestHandler; /** * Check if handler is an async function */ export declare function isAsyncFunction(fn: Function): boolean; /** * Check if handler returns a Promise */ export declare function returnsPromise(fn: Function, ...args: any[]): boolean; //# sourceMappingURL=async-wrapper.d.ts.map