title: Create dynamic class instances in typescript
body: <p>I am working with webpack, typescript 2.8, es5.</p>
  
  <p>I want to create dynamic class instances from variable names for example:</p>
  
  <pre><code>protected handleAfterInit(page) : void 
  {
  
      let instance: any;
      let pageName: string = this.capitalizeFirstLetter(page);
  
      console.log(pageName);
  
      instance = Object.create((window[pageName]).prototype);
      instance.constructor.apply(instance);
  
      console.log(instance);
  }
  </code></pre>
  
  <p>Where pageName is a variable (Home, About etc) and those classes are already imported on top of the page:</p>
  
  <pre><code>import { Home } from "./Home";
  import { About } from "./About";
  </code></pre>
  
  <p>But with current code I get an error:</p>
  
  <blockquote>
    <p>Cannot read property 'prototype' of undefined</p>
  </blockquote>
  
  <p>It seems that there is no window.{class}</p>
  
  <p>Is it possible to do something like this in typescript?</p>