title: Typescript: private member is suddenly undefined
body: <p>So, I've got a basic Typescript application, that shouldn't actually cause any major problems, but it seems, that something's going wrong here and I have no idea what.</p>
  
  <p>I do have this private member <code>minUpdateRate</code> in my <code>GameContainer</code> class, that is initialized in the constructor. This seems to go well, because when <code>GameContainer.start()</code> is called, the <code>console.log()</code> method will print out <code>1</code>.</p>
  
  <p>However, when the <code>GameContainer.render()</code> method is called, it seems to be out of the scope or something, the log method outputs <code>undefined</code> there.</p>
  
  <p>I'm pretty new to TypeScript and not that deep into JavaScript either (especially when it comes to scopes, it's getting confusing to me :/). How can I however solve this?</p>
  
  <p>Main class:</p>
  
  <pre><code>class TwoDGame extends Game {
      public static main(context:CanvasRenderingContext2D) {
          var game:Game = new TwoDGame();
          var container:GameContainer = new GameContainer(context, game);
  
          container.start();
  
          return game;
      }
  }
  </code></pre>
  
  <p>Game Container class:</p>
  
  <pre><code>class GameContainer {
      ...
      private minUpdateRate:number;
      private game:Game;
      private time:number;
      ...
  
      constructor(context:CanvasRenderingContext2D, game:Game) {
          ...
          this.minUpdateRate = 1;
          this.game = game;
      }
  
      public start() {
          ...
          console.log(this.minUpdateRate);
      }
  
      public render() {
          var now:number = new Date().getMilliseconds();
          var delta:number = now - this.time;
          console.log(this.minUpdateRate);
  
          if (delta &gt; this.minUpdateRate) {
              ...
          }
      }
  }
  </code></pre>
  
  <p>Render is called via setInterval in the script area:</p>
  
  <pre><code>var game = TwoDGame.main(context);
  
  setInterval(game.getGameContainer().render, 16);
  </code></pre>