title: How to write a TypeScript function accepting a class implementing an interface as a parameter?
body: <p>I want to write a function which accepts a class as an argument, but only classes which <code>implement</code> a specific interface.</p>
  
  <p>I know that I can use <code>any</code>, but it would be nice to rely on the type system to enforce this.</p>
  
  <p>Some pseudocode to express what I mean...</p>
  
  <pre><code>interface MyInterface { ... }
  class Class1 implements MyInterface { ... }
  class Class2 { ... }
  
  function doStuff(classParameter: Class implements MyInterface) { ... }
  doStuff(Class1); // OK
  doStuff(Class2); // Error
  </code></pre>