Open
Description
Currently our recommended installation is failing type checks for typescript projects including express > 5.0.
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>>, next: NextFunction) => void' is not assignable to parameter of type 'PathParams'.
12 app.use(Honeybadger.requestHandler);
~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@types/express-serve-static-core/index.d.ts:157:5
157 <
~
158 P = ParamsDictionary,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
166 ...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167 ): T;
~~~~~~~~~
The last overload is declared here.
A workaround is to ignore the type errors with something like this:
app.use(Honeybadger.requestHandler as unknown as express.RequestHandler);
We should update the type definitions for Honeybadger.requestHandler and errorHandler to be compatible with Express 5’s middleware types, so TypeScript projects do not require unsafe type casts.
Metadata
Metadata
Assignees
Labels
No labels