title: Typescript generics for type A is a Class and B is a class that implements Interface<A>
body: <p>I would like to have a type safe register function that registers a WorkerOf with two arguments and two generic types so that consumers have to register a ClassA with the corresponding WorkerOfA.</p>
  <pre class="lang-js prettyprint-override"><code>type Worker&lt;Payload&gt; = { exec: (payload: Payload) =&gt; Promise&lt;void&gt; };
  type Constructor&lt;Payload&gt; = new (...args: any[]) =&gt; Payload;
  type WorkerConstructor&lt;Payload extends Constructor&lt;Payload&gt;&gt; = new (
    ...args: any[]
  ) =&gt; Worker&lt;Payload&gt;;
  
  function register&lt;Payload extends Constructor&lt;Payload&gt;&gt;(
    _pyd: Payload,
    _wkr: WorkerConstructor&lt;Payload&gt;
  ) {}
  
  class PayloadOne {}
  class PayloadTwo {}
  class WorkerOne implements Worker&lt;PayloadOne&gt; {
    constructor() {}
    async exec(_payload: PayloadOne): Promise&lt;void&gt; {}
  }
  
  // Expected to work because WorkerOne implements Worker&lt;PayloadOne&gt;
  register(PayloadOne, WorkerOne);
  // Expected to fail because WorkerOne doesn't implements Worker&lt;PayloadTwo&gt;
  register(PayloadTwo, WorkerOne);
  </code></pre>
  <p>In both cases I am getting the following typescript error:</p>
  <p><code>Argument of type 'typeof PayloadOne' is not assignable to parameter of type 'Constructor&lt;typeof PayloadOne&gt;'. Property 'prototype' is missing in type 'PayloadOne' but required in type 'typeof PayloadOne'.ts(2345)</code></p>