title: Reference the generic type of a generic type in Typescript?
body: <p>Is it possible to reference the generic type of a generic type in Typescript ? Basically, for the given types:</p>
  <pre class="lang-js prettyprint-override"><code>class BaseClass&lt;SomeType&gt; {
    // ...
  }
  
  class InheritedClass extends BaseClass&lt;string&gt; { }
  
  class Wrapper&lt;AnyBaseClass extends BaseClass&lt;any&gt;&gt; {
    state: AnyBaseClass[&lt;SomeType&gt;]; // What should I put here ?
  }
  
  const wrapper = new Wrapper&lt;InheritedClass&gt;();
  wrapper.state = &quot;foo&quot;; // Ok
  wrapper.state = 4; // Not ok
  </code></pre>
  <p>I'd like the type of my property <code>state</code> to depend on which inner generic parameter was given to <code>Wrapper</code>.</p>
  <p>Is there a way to reference this inner generic type? The only solution I've found is to try to find it using <code>ReturnType&lt;...&gt;</code> or <code>AnyBaseClass[&quot;anyPropertyOfTypeSomeType&quot;]</code>, but I would prefer to have a direct way of referencing this type.</p>
  <p>Thanks in advance!</p>