You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Router.get method in Express is called with the wrong type: The request handler is mistaken for a child application #6304
Note: I use the typescript
When using the tokenRouter.get method in the auth/token.ts file to define a route handler, the TypeScript compiler throws a type mismatch error. The error message is as follows:
The console messages
auth/token.ts:15:30 - error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type '(req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>) => Response<...> | undefined' is not assignable to parameter of type 'Application<Record<string, any>>'.
Type '(req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>) => Response<...> | undefined' is missing the following properties from type 'Application<Record<string, any>>': init, defaultConfiguration, engine, set, and 63 more.
node_modules/@types/express-serve-static-core/index.d.ts:168:5
168 (path: PathParams, subApplication: Application): T;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The last overload is declared here.
Activity
bjohansebas commentedon Jan 30, 2025
Could you please provide the version of Express, TypeScript, and the version of the types you are using?