I have this small piece of code
import express from 'express';
const app = express();
const port = 3000;
app.get('/', (req, res) => {
res.send('The sedulous hyena ate the antelope!');
});
app.listen(port, err => { //show error here
if (err) {
return console.error(err);
}
return console.log(`server is listening on ${port}`);
});
I wonder why this message pop up
No overload matches this call.
The last overload gave the following error.
Argument of type '(err: any) => void' is not assignable to parameter of type '() => void'.ts(2769)
I didn't declare type for req and res, but why typescript show error only for the err?