title: How to cast abstract class to non-abstract class?
body: <p>If I have an <code>abstract class Adapter {}</code>, I'd like to create a function which accepts a non-abstract constructor extending this class and returns a new instance of the class.</p>
  
  <p>e.g.</p>
  
  <pre class="lang-js prettyprint-override"><code>export abstract class Adapter {}
  
  export function change(adapterConstructor: typeof Adapter) {
    return new adapterConstructor();
  }
  </code></pre>
  
  <p>Unfortunately, this example doesn't work because the typescript compiler correctly complains that an abstract class cannot be instantiated.</p>
  
  <p>Is it possible to limit the <code>adapterConstructor</code> argument to only non-abstract implementations of <code>typeof Adapter</code>?</p>
  
  <p>i.e. something like</p>
  
  <pre class="lang-js prettyprint-override"><code>export abstract class Adapter {}
  
  export function change(adapterConstructor: NonAbstract&lt;typeof Adapter&gt;) {
    return new adapterConstructor();
  }
  </code></pre>
  
  <p>At the moment, my solution is to simply make the <code>Adapter</code> class non-abstract and have all of the methods which <em>should</em> be abstract throw errors.</p>