title: Enumerate all classes implementing an interface in Typescript
body: <p>Hello fellow Typescripters!</p>
  
  <p>Here's what I want to do: I want to create an interface -- let's say <em>IShape</em> -- and have a bunch of classes (<em>Rectangle</em>, <em>Circle</em>, <em>Triangle</em>) that implement <em>IShape</em>.</p>
  
  <p>Let's assume <em>IShape</em> has a method called <em>GetName</em> that returns a string which consists of the name of the shape. For the sake of this discussion, let's assume that each class implementing <em>GetName</em> returns a hard-coded string (e.g.: "Rectangle", "Round thing", "Pointy thing"). Let's also pretend than <em>IShape</em> also implements the <em>Draw</em> method.</p>
  
  <p>At run time, I would like to be able to list and initialize all the classes that implement <em>IShape</em> so that I could show a drop-down of what "shape" the user can select from. When user selects the shape type, the system calls the <em>Draw</em> method for that shape.</p>
  
  <p>But here's the kicker: later, I want to be able to create a new classes that implements <em>IShape</em> (let's say <em>Square</em>, and <em>Oval</em>). Next type I run the code, I want the new classes to appear in my drop down without having to change (too much of) the rest of the code.</p>
  
  <p>How would one do this in Typescript?</p>
  
  <p>My goal is to create something that allows other team members to extend my code by adding new "shapes" that implement my interface without having to have a hard-coded list of shapes to accept.</p>
  
  <p>Thank you in advance for your help.</p>