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:
Share Improve this question asked 2 days ago Andrew LobbanAndrew Lobban 2,1373 gold badges25 silver badges39 bronze badgesNo 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)
1 Answer
Reset to default -1Solution was so easy. All I had to do was type cast my middleware as RequestHandler and all was forgiven.
版权声明:本文标题:node.js - TS Error No overload matches this call when extending Request Interface in middleware - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736631895a1945799.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论