Argument of type '(req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>, res: Response<any, MyLocals>) => Promise<...>' is not assignable to parameter of type '(req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>, number>, next: NextFunction) => void | Promise<...>'.
Types of parameters 'res' and 'res' are incompatible.
Type 'Response<any, Record<string, any>, number>' is not assignable to type 'Response<any, MyLocals>'.
Types of property 'locals' are incompatible.
Property 'something' is missing in type 'Record<string, any>' but required in type 'MyLocals'.ts(2345)
Express
RequestHandler
has a fifth genericLocals
that controls the typing of theres.locals
property.With the current version of express-async-handler it's impossible to pass that generic.
Without this fix it shows an error:
With the Locals generic it works as expected