title: Typescript/React ForwardRefExoticComponent assignment with more specific HTMLElement ref fails
body: <p>I am trying to write a HOC and type the children which you can pass to it.</p>
  <p>the scenario looks somewhat like this (also in this sandbox: <a href="https://codesandbox.io/s/amazing-taussig-h2dpm?file=/src/App.tsx" rel="nofollow noreferrer">https://codesandbox.io/s/amazing-taussig-h2dpm?file=/src/App.tsx</a>):</p>
  <pre class="lang-js prettyprint-override"><code>interface HOCProps {
      modules: React.ForwardRefExoticComponent&lt;
          HOCChildProps &amp; React.RefAttributes&lt;HTMLElement&gt;
      &gt;[];
  }
  interface HOCChildProps {
      ...
  }
  declare const HOC: React.FC&lt;HOCProps&gt;;
  
  // this produces an error in HOCTest if HTMLDivElement is used
  // and an error in HOCChildTest if HTMLElement is used
  // as the ref type in React.forwardRef
  const HOCChildTest = React.forwardRef&lt;HTMLDivElement, HOCChildProps&gt;(
      (props, ref) =&gt; (
          &lt;div ref={ref}&gt;
              ...
          &lt;/div&gt;
      )
  );
  const HOCTest: React.FC = () =&gt; &lt;HOC modules={[HOCChildTest]} /&gt;;
  </code></pre>
  <p>the code is still working, but the typings are not.</p>
  <p>it seems that this assignment fails:</p>
  <pre class="lang-js prettyprint-override"><code>declare const divTest: React.ForwardRefExoticComponent&lt;
      React.RefAttributes&lt;HTMLDivElement&gt;
  &gt;;
  
  export const htmlTest: React.ForwardRefExoticComponent&lt;
      React.RefAttributes&lt;HTMLElement&gt;
  &gt; = divTest;
  </code></pre>
  <p>The Typescript error message:</p>
  <pre><code>Type 'ForwardRefExoticComponent&lt;RefAttributes&lt;HTMLDivElement&gt;&gt;' is not assignable to type 'ForwardRefExoticComponent&lt;RefAttributes&lt;HTMLElement&gt;&gt;'.
    Types of parameters 'props' and 'props' are incompatible.
      Type 'RefAttributes&lt;HTMLElement&gt;' is not assignable to type 'RefAttributes&lt;HTMLDivElement&gt;'.
  </code></pre>
  <p>In the last line it states that I am trying to assign <code>RefAttributes&lt;HTMLElement&gt;</code> to <code>RefAttributes&lt;HTMLDivElement&gt;</code>, but I do the assignment the other way round (as the first line correctly shows).</p>
  <p>Am I missing out on something? Because I assumed that a component with a more specific HTMLDivElement ref would be assignable to a component with a more general HTMLElement ref.</p>