import { RequestHandler } from 'express'; import { Request, Response, NextFunction } from 'express-serve-static-core'; export interface CustomParamsDictionary { [key: string]: any; } const catchAsync = (fn: RequestHandler>) => ( req: Request>, res: Response, number>, next: NextFunction ) => { Promise.resolve(fn(req, res, next)).catch((err) => next(err)); }; export default catchAsync;