admin管理员组

文章数量:1125558

Below I have the code and the TS Error trigger in the terminal when I try to use my middleware to extend Express' Request interface.

When I hover over the issue I get the following:

No overload matches this call. The last overload gave the following error. Argument of type '(req: Request, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>' is not assignable to parameter of type 'PathParams'.ts(2769)

Below I have the code and the TS Error trigger in the terminal when I try to use my middleware to extend Express' Request interface.

When I hover over the issue I get the following:

No overload matches this call. The last overload gave the following error. Argument of type '(req: Request, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>' is not assignable to parameter of type 'PathParams'.ts(2769)

Share Improve this question asked 2 days ago Andrew LobbanAndrew Lobban 2,1373 gold badges25 silver badges39 bronze badges
Add a comment  | 

1 Answer 1

Reset to default -1

Solution was so easy. All I had to do was type cast my middleware as RequestHandler and all was forgiven.

本文标签: nodejsTS Error No overload matches this call when extending Request Interface in middlewareStack Overflow