title: Dynamically Set Type of Prop Based on Another Prop
body: <p>If I have an interface like the following:</p>
  <pre><code>interface Example {
      Component: React.ReactElement;
      componentProperties: typeof Example.Component;
  }
  </code></pre>
  <p>Is there a way to get the type of the properties that that component passed in expects. So say I pass in a custom component like the following:</p>
  <pre><code>const Text = ({ value: string }) =&gt; &lt;p&gt;{value}&lt;/p&gt;;
  </code></pre>
  <p>The type of componentProperties I would like to equal <code>{ value: string }</code></p>
  <hr />
  <p>I think I am looking something closer to this where the typeof the Component is what determines the type for componentProperties:</p>
  <pre><code>interface Example&lt;T&gt; {
      Component: () =&gt; React.ReactElement;
      componentProperties: T;
  }
  
  const Comp = ({ value }: { value: string}) =&gt; &lt;p&gt;{value}&lt;/p&gt;;
  
  const blah = ({ Component, componentProperties }: Example&lt;typeof Component&gt;) =&gt; {
      return &lt;Component {...componentProperties} /&gt;;
  };
  
  blah({
      Component: Comp,
      componentProperties: { value: 'test' }
  });
  </code></pre>
  <p>This example is riddled with errors which is why I am having trouble.</p>