#req.query
5 messages · Page 1 of 1 (latest)
Apparently your query property is declared as being able to have multiple possible types
(e.g. string but also string[]
This means you cannot just call split on it because it is not valid to call that method on an array of strings (string[]).
So you will have to narrow the type first, for example:
const sortBy = req.query.sort instanceof Array ? req.query.sort : req.query.sort.split(',')