title: Why react router v6 useParams returns object with properties possibly 'undefined'?
body: <p>Why react router v6 <a href="https://reactrouter.com/docs/en/v6/api#useparams" rel="noreferrer">useParams</a> returns object with properties possibly 'undefined'?</p>
  <p>In my code below, my IDE indicates <code>const slug: string | undefined</code>.</p>
  <pre><code>const { slug } = useParams&lt;&quot;slug&quot;&gt;();
  </code></pre>
  <p>It is because of the <a href="https://github.com/remix-run/react-router/blob/c68df0c2328bcbd889ca486e790ba2efa3ea9ae4/packages/react-router/index.tsx#L735" rel="noreferrer"><code>Params</code> type definition</a>:</p>
  <pre><code>/**
   * The parameters that were parsed from the URL path.
   */
  export type Params&lt;Key extends string = string&gt; = {
    readonly [key in Key]: string | undefined;
  };
  </code></pre>
  <p>But why is not <code>Params</code> defined like this (without the <code>| undefined</code>):</p>
  <pre><code>export type Params&lt;Key extends string = string&gt; = {
    readonly [key in Key]: string;
  };
  </code></pre>
  <p>If a route with a parameter matches the URL then the parameter cannot be <code>undefined</code>. So, is there any case when <code>useParams</code> returns with an <code>undefined</code> param?</p>