router.get("/tip/:id", (req: Request, res: Response): void => {
const id: number = parseInt(req.params.id);
const tip: string = tips[id - 1];
res.render("tip", {
title: "Tip",
id: id,
tip: tip,
});
});
TSError: ⨯ Unable to compile TypeScript:
server/routes.ts:23:31 - error TS2345: Argument of type 'string | string[]' is not assignable to parameter of type 'string'.
Type 'string[]' is not assignable to type 'string'.
23 const id: number = parseInt(req.params.id);
~~~~~~~~~~~~
Can someone explain why the path param is being considered as both an array of string and not only a string pls