Next.js' API Routes receive a req object - it's an extension of http.IncomingMessage with additional middlewares such as req.query. The typing of req.query, found in their utils.ts, is:
query: {
[key: string]: string | string[]
}
Why is it possible to receive an array of strings from the query?
I'm trying to perform string methods on my query values but run into TS errors -_-
someString.split() // => Property 'split' does not exist on type 'string | string[]'.