title: Abstract Constructor on Abstract Class in TypeScript
body: <p>How can I create an abstract constructor for an abstract class? </p>
  
  <p>For example, if I have this abstract class:</p>
  
  <pre><code>export abstract class Foo&lt;T&gt; extends Bar&lt;T&gt; {
    constructor(someParam: any) {
      super();
      this.someObj = someParam;
    }
  }
  </code></pre>
  
  <p>Then it is consumed by this class:</p>
  
  <pre><code>export class FooImpl extends Foo&lt;SomeType&gt; {
  }
  </code></pre>
  
  <p>If I don't override the constructor then the default parameterless constructor will be used on the <code>FooImpl</code> class which will lead to an improper state within the class. </p>
  
  <p>How can I define an abstract constructor or force consumers of the abstract class to override the constructor when <code>Foo&lt;T&gt;</code> is consumed?</p>
  
  <p>EDIT</p>
  
  <p>The exact code I have is below and would appear that this is somehow related to vscode</p>
  
  <pre><code>export abstract class FireStoreDataSource&lt;T&gt; extends DataSource&lt;T&gt; {
    constructor(store: () =&gt; Observable&lt;T[]&gt;) {
      super();
    }
  }
  </code></pre>
  
  <p>Then I am extending this class as follows</p>
  
  <pre><code>export class AssessmentCenterDataSource extends FireStoreDataSource&lt;AssessmentCenter&gt; {
  }
  </code></pre>
  
  <p>Then creating an instance in an angular component <code>ngOnInit</code></p>
  
  <pre><code>ngOnInit() {
    this.dataSource = new AssessmentCenterDataSource(() =&gt; this.service.getData());
  }
  </code></pre>
  
  <p>Here in vscode I am getting the compiler error <code>[ts] Expected 0 arguments, but got 1.</code>, however when I run <code>ng build</code> it does build correctly</p>
  
  <p>If I do not pass anything to the constructor then the compiler error goes away and I get an error when I run <code>ng build</code> which is <code>error TS2554: Expected 1 arguments, but got 0.</code></p>
  
  <p>So it looks like this might be an issue with vscode or one of the addons I have installed rather than typescript</p>
  
  <p>I am using vscode insiders 1.26.0 and typescript insiders 3.0.1 along with Angular 6</p>