I have a unique function along with an interface that defines its single argument:
interface AnotherInterface {
property1: string;
property2: string;
}
function processData(data: AnotherInterface): Promise<any> {
return Promise.resolve(data)
}
This particular function serves as a controller in an express application:
router.get('/document', (req, res) => {
processData(req.query).then(data => res.status(200).send(data))
})
When passing req.query to processData, TypeScript highlights it and prompts:
The argument of type 'ParsedQs' cannot be assigned to the parameter of type AnotherInterface
Looking for ways to resolve this issue?