title: TypeScript: how to extract the generic parameter from a type?
body: <p>Say I have a type like <code>React.ComponentClass&lt;Props&gt;</code> and I want to reference the <code>Props</code> part but it is unnamed in my current context.</p>
  
  <p>To illustrate:</p>
  
  <pre><code>const x = makeComponent(); // typeof x = React.ComponentClass&lt;Something&gt;
  </code></pre>
  
  <p>In this situation, I can use <code>typeof x</code> but that doesn't give me direct
  access to the <code>Something</code> type.</p>
  
  <p>What I want is something like this:</p>
  
  <pre><code>type GetPropsType&lt;C extends React.ComponentClass&lt;P&gt;&gt; = P
  </code></pre>
  
  <p>So that I can extract <code>Something</code> with the type <code>GetPropsType&lt;typeof x&gt;</code></p>
  
  <p>Anything equivalent would be great.</p>