title: Typescript generics - extending generic parameter
body: <p>Long-time C++ guy getting deeper into Typescript.  Here's the basic setup of classes I'm importing from a library:</p>
  <pre><code>export abstract class A&lt;T&gt; {
      ...
      // Common functionality
  }
  
  export class B extends A&lt;B&gt; {
      ...
  }
  
  export class C extends A&lt;C&gt; {
      ...
  }
  
  export class D extends A&lt;D&gt; {
  }
  </code></pre>
  <p>So essentially B, C, and D have their own public API, but all share the common API and implementation of A.</p>
  <p>Now I'd like to create my own extension X of A with more common functionality, and create BX, CX, and DX that share this new functionality as well.</p>
  <p>In C++ you could do something like:</p>
  <pre><code>&lt;template T&gt;
  class X : public T {
      ...
      // Common functionality
  };
  
  class BX : public X&lt;B&gt; {
      ...
  }
  </code></pre>
  <p>I'm trying to figure out the correct syntax for this in Typescript.  Doing something like:</p>
  <pre><code>class X&lt;T&gt; extends T {
  }
  </code></pre>
  <p>in Typescript gives an error.  Also I'd like to add the constraint that T extends A at some point.</p>
  <p>Can someone provide some insight for me?  Thanks in advance!</p>
  <ul>
  <li>Steve</li>
  </ul>