My question is similar with TypeScript Express Error Function.
BUT the point of question is different. Why does the TypeScript cannot recognize the type of Express's error handler format?
I've also installed @type/express
module.
When I change
// doesn't work showing type checking error
app.use((err, req, res, next) => {
// SOMETHING
});
into
// works.
app.use((err: any, req:express.Request, res: express.Response, next: express.NextFunction) => {
// SOMETHING
});
, it works.