To specify the type of req.body as PersoneModel, I can do something like this:
import { Request, Response } from 'express';
router.post('/',(req: Request<{}, any, PersoneModel>, res: Response) => {
// req.body is now PersoneModel
}
However, a potential issue arises when I override the original Request Type with
P extends core.Params = core.ParamsDictionary
, as shown below.
interface Request<P extends core.Params = core.ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = core.Query> extends core.Request<P, ResBody, ReqBody, ReqQuery> { }
Is there a way to prevent or avoid this conflict?