title: nextjs API with typescript, restricting NextApiRequest query param to just string type
body: <p>In this endpoint handler, is there a way to restrict <code>req.query</code> in NextJS <code>NextApiRequest</code> to just <code>string</code> types rather than <code>string | string[]</code>. For example, <code>someQueryParam</code> here is of <code>string | string[]</code> type but I want to use it as just <code>string</code> type</p>
  <pre><code>export default async function handler(
    req: NextApiRequest,
    res: NextApiResponse&lt;Response&gt;
  ) {
  
     const { someQueryParam } = req.query;
     
     // pass in someQueryParam as a string into a function call
     const result = functionCall(someQueryParam)
  }
  </code></pre>
  <p>typescript error when passing someQueryParam into a function that only accepts <code>string</code> type for the argument:</p>
  <pre><code>Argument of type 'string | string[]' is not assignable to parameter of type 'string'.
    Type 'string[]' is not assignable to type 'string'.
  </code></pre>
  <p>For reference, here is the definition of <code>NextApiRequest</code> in the Nextjs library</p>
  <p><a href="https://i.stack.imgur.com/s9Lud.png" rel="noreferrer"><img src="https://i.stack.imgur.com/s9Lud.png" alt="nextjs NextApiRequest" /></a></p>
  <p>also open to any suggestions to somehow use <code>someQueryParam</code> as <code>string</code> type rather than <code>string | string[]</code> type within the handler before passing it into function</p>