I have two query params from the url and trying to take them out by using {} and assign types to them. However, it is causing error.
const {firstName: string, lastName: string} = req.query;
I am getting cannot redeclare block-scoped variable 'string'.. Is it possible to assign type inside the {}? Or, do I have to assign them one by one?
const variableName: {firstName: string, lastName: string} = req.query;Or, if you are trying to destructure the object, the posted answer from tkausl is applicable.