title: Cannot read property 'prototype' of undefined when extending classes
body: <p>I am having an issue with extending items, where I am getting:</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'prototype' of undefined</p>
  </blockquote>
  
  <p>From what I have read items need to be defined in a particular order, so here is what I am doing, as it seems like they are in the correct order.</p>
  
  <p>This doesn't happen at compile time, but at runtime in the browser. I am compiling the files into one file with <a href="https://www.npmjs.com/package/browserify" rel="noreferrer">browserify</a> and <a href="https://www.npmjs.com/package/tsify" rel="noreferrer">tsify</a>.</p>
  
  <p>Here is my entry point <strong>main.ts</strong>:</p>
  
  <pre><code>import GameSmartWeb from './GameSmartWeb';
  window.gs = new GameSmartWeb();
  </code></pre>
  
  <p>It then calls this file <strong>GameSmartWeb.ts</strong> which references a GUI class:</p>
  
  <pre><code>import GUI from './apis/GUI';
  export default class GameSmartWeb {
      public get gui(): GUI { return new GUI(); }
  }
  </code></pre>
  
  <p>Then the GUI class <strong>apis/GUI.ts</strong> looks somewhat like this:</p>
  
  <pre><code>export default class GUI extends GameSmartWeb {
      public get rewards(): Rewards { return new Rewards(); }
  }
  
  class Rewards extends GUI {
      // More methods
  }
  </code></pre>
  
  <p>When looking in the browser it says the error is here:</p>
  
  <pre><code>var __extends = (this &amp;&amp; this.__extends) || function (d, b) {
      for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
      function __() { this.constructor = d; }
      d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); // The error is on this line
  };
  var GUI = (function (_super) {
      __extends(GUI, _super); // This is the call to the function
      // more auto generated code
  });
  </code></pre>