title: Compile error when extending a class in typescript
body: <p>I saw this question which is similar :</p>
  
  <p><a href="https://stackoverflow.com/questions/14156414/cross-referencing-with-extended-classes-in-typescipt">Cross referencing with extended classes in TypeScipt</a></p>
  
  <p>though i couldnt figure out what was wrong still. My problem is that i have a class gameobject that i want to extend but as long as the sprite class that entends gameobject exists i get an error</p>
  
  <pre><code>module Game {
  export class GameObject {
      x = 0;
      y = 0;
      W = 0;
      H = 0;
      img = new Image();
      scale = 0;
  
      constructor(img, x, y, w, h, scale?) {
          this.img = img;
          this.x = x || 0;
          this.y = y || 0;
          this.W = w;
          this.H = h;
          this.scale = scale || 1;
      }
      update() {
  
      }
      render(context, x, y) {
          context.drawImage(this.img, this.x, this.y, this.W, this.H, x, y, this.W * this.scale, this.H * this.scale);
      }
  }
  }
  </code></pre>
  
  <p>.</p>
  
  <pre><code>module Game {
  export class Sprite extends GameObject {
  
  }
  }
  </code></pre>
  
  <p>I get the following error:</p>
  
  <p>Uncaught TypeError: Cannot read property 'prototype' of undefined </p>
  
  <p>Uncaught TypeError: undefined is not a function </p>
  
  <p>According to the post at the top, it seems like i have a circular dependency and it it calling the sprite class first for some reason?</p>
  
  <p>Thanks in advance.</p>