title: Typescript error in Enzyme unit-tests saying pathname doesn't exist on type LocationDescriptor<unknown>
body: <p>In the unit-tests, I'm using <code>typescript</code> and <code>enzyme</code>. I'm testing a <code>Link</code> component, which I took from the <code>react-router-dom</code>. The test runs fine, but <code>typescript</code> keeps complaining that the pathname doesn't exist in the <code>LocationDescriptor</code> type:</p>
  <blockquote>
  <p>Property 'pathname' does not exist on type 'LocationDescriptor | ((location: Location) =&gt; LocationDescriptor)'.
  Property 'pathname' does not exist on type 'string'.</p>
  </blockquote>
  <p>The pathname does exist but I don't understand what the cause is. I think the error has something to do with <code>react-router-dom</code> types or the <code>ShallowWrapper</code>, but I'm not sure what to do. Can someone please tell me how to get rid of the error and explain what the error means? Many Thanks.</p>
  <p>Test:</p>
  <pre><code>import React from 'react';
  import { Link } from 'react-router-dom';
  import { shallow, ShallowWrapper } from 'enzyme';
  import { Order } from '.';
  ...
  
  it('Order cards by default using date in descending', () =&gt; {
    const component: ShallowWrapper = shallow(
      &lt;Order {...props} /&gt;
    );
  
    const links = component.find(Link);
  
    expect(links.at(0).prop('to').pathname).toEqual(
      '/order/DIGITAL/1111'
    );
  });
  </code></pre>
  <p>Test subject:</p>
  <pre><code>import React from 'react';
  ...
  
  export const Order = (props: OrderProps) =&gt; {
    ...
    return (
      &lt;Link
        key={props.order.orderId}
        to={{
          pathname: `/order/${props.order.brand}/${props.order.orderId}`,
          state: { securityAddressed: true },
        }}
        className=&quot;order-history-link&quot;
      &gt;
        &lt;Card
          key={props.order.orderId}
          title1={title1}
          title2={!isEmpty(props.order) &amp;&amp; getOrderDetails(props.order)}
        /&gt;
      &lt;/Link&gt;
    );
  };
  </code></pre>