title: How to use query params in Next.js?
body: <p>In my Next.js API functions like:</p>
  <pre><code>export default async function handler(req: NextApiRequest, res: NextApiResponse&lt;any&gt;) {
    const { someQueryParam } = req.query;
    doSomething(someQueryParam);
    ...
  </code></pre>
  <p>I see TypeScript error:</p>
  <blockquote>
  <p>Argument of type 'string | string[]' is not assignable to parameter of type 'string'.
  Type 'string[]' is not assignable to type 'string'.ts(2345)</p>
  </blockquote>
  <p>So I've started using this helper function I wrote:</p>
  <pre><code>export function getSimpleStringFromParam(paramValue: string | string[] | undefined) {
    if (paramValue) {
      return typeof paramValue === 'string' ? paramValue : paramValue[0];
    } else {
      return '';
    }
  }
  </code></pre>
  <p>It works fine, but it feels ugly and weird and feels like what I'm trying to do would be such a common need that Next.js or Node would handle it more smoothly. So I feel like I'm misunderstanding something.</p>
  <p>Is there a more official / better way to pluck simple string values out of the query params?</p>