In this demo I'm attempting to use the DefintelyTyped Response and Request types for the req, res parameters. However this does not compile:
const express = require('express');
const app = express();
app.get('/', (req:Request, res:Response) => {
res.send('Hello Express Lovers!');
});
app.listen(3000, () => console.log('server started'));
The error is:
^
TSError: ⨯ Unable to compile TypeScript:
index.ts:4:9 - error TS2339: Property 'send' does not exist on type'Response'.