title: Typescript function to generate a class implementing an interface
body: <p>My question is on a point I don't understand in a mechanism of typescript: why in the following code, ComposerA is correct and ComposerB is not ?</p>
  
  <pre><code>type Ctor&lt;T = {}&gt; = new (...args: any[]) =&gt; T;
  
  function ComposerA&lt;T extends Ctor&gt;(Target: T) {
    return class extends Target {
      ...
    }
  }
  
  function ComposerB&lt;T extends Ctor&gt;(Target: T) {
    return class implements Target {
      ...
    }
  }
  
  </code></pre>
  
  <p>In ComposerB I obtain the error -> 'Target' refers to a value, but is being used as a type here. </p>
  
  <p>I think there is a concept I haven't understood. Is it possible to realize a function which take an object and implements it. I need implements and not extends, this example is a simplification of my original code and I've already an extend of another class.</p>