title: React + Typescript: copying props of a custom component - React.PropsWithoutRef doesn't work for me
body: <p>I have a component that wraps <code>Router</code> and takes an additional props. I tried using <code>PropsWithoutRef</code> in a way that's analogous to the use in <a href="https://github.com/typescript-cheatsheets/react-typescript-cheatsheet#useful-react-prop-type-examples" rel="nofollow noreferrer"><strong>this cheatsheet</strong></a>:</p>
  
  <pre><code>import React, { ComponentType, PropsWithoutRef } from 'react'
  import { Route } from 'react-router'
  
  type LayoutRouteProps = PropsWithoutRef&lt;Route&gt; &amp; {
      component: ComponentType,
  };
  
  
  const DashboardLayoutRoute = ({
      component: Component,
      ...rest
  }: LayoutRouteProps) =&gt; {
      const render = (props: any)=&gt; &lt;Component {...props} /&gt;
  
      return &lt;Route {...rest} render={render} /&gt;
  };
  </code></pre>
  
  <p>But it did no good. When I try to use <code>DashboardLayoutRoute</code> and pass props relevant to <code>Route</code>:</p>
  
  <pre><code>&lt;DashboardLayoutRoute exact path='/' component={Home} /&gt;
  </code></pre>
  
  <p>I get</p>
  
  <blockquote>
    <p>Error:(63, 39) TS2322: Type '{ exact: true; path: string; component: any; }' is not assignable to type 'IntrinsicAttributes &amp; Route &amp; { component: ComponentType&lt;{}>; }'.</p>
    
    <blockquote>
      <p>Property 'exact' does not exist on type 'IntrinsicAttributes &amp; Route &amp; { component: ComponentType&lt;{}>; }'.</p>
    </blockquote>
    
    <p>Error:(66, 39) TS2322: Type '{ path: string; component: any; }' is not assignable to type 'IntrinsicAttributes &amp; Route &amp; { component: ComponentType&lt;{}>; }'.</p>
    
    <blockquote>
      <p>Property 'path' does not exist on type 'IntrinsicAttributes &amp; Route &amp; { component: ComponentType&lt;{}>; }'.</p>
    </blockquote>
  </blockquote>
  
  <p>What's wrong with my code?</p>