title: Typescript generic class parameters
body: <p>I am currently programming some internal abstract class for project and I need it to be generic (I want it to be extendable).</p>
  
  <p>I want my class to be called as it would extend the T template like <code>Sample extends T</code>, in order to have all the parameters of <code>T</code>.
  For example if <code>T</code> is Vue, I would have all Vue parameters such as <code>$el</code> or <code>$options</code> without re-declaring Vue nor including it.</p>
  
  <p>So I've got the following :</p>
  
  <pre><code>export namespace SDK {
  
    export abstract class Sample&lt;T&gt; {
  
      private static methods: any = {
        hello: Sample.prototype.hello
      }
  
      abstract callMe () : void;
  
      x: number = 0
      y: number = 0
      width: number = 1
      height: number = 1
  
      hello (): void {
        console.log('Sample hello world')
        this.callMe()
      }
    }
  }
  </code></pre>
  
  <p>But I don't know how to process to include the properties of T into Sample.</p>
  
  <p>I would like it to be like:</p>
  
  <pre><code>export namespace SDK {
  
    export abstract class Sample&lt;T&gt; {
  
      private static methods: any = {
        hello: Sample.prototype.hello
      }
  
      abstract callMe () : void;
  
      x: number = 0
      y: number = 0
      width: number = 1
      height: number = 1
  
      // T properties (Vue example)
      $el: HTMLElement
      ...
  
      hello (): void {
        console.log('Sample hello world')
        this.callMe()
      }
    }
  }
  </code></pre>
  
  <p>I would like my class to be called like:</p>
  
  <pre><code>export default class MyComponent extends SDK.Sample&lt;Vue&gt; {
    name: string = 'my-component';
  
    callMe () : void {
      console.log('called')
    }
  
    mounted () : void {
      this.hello()
    }
  }
  </code></pre>
  
  <p>I did not find anything about extending from a templated class that allow to have parameters in it.</p>