title: TypeScript "this" scoping issue when called in jquery callback
body: <p>I'm not sure of the best approach for handling scoping of &quot;this&quot; in TypeScript.</p>
  <p>Here's an example of a common pattern in the code I am converting over to TypeScript:</p>
  <pre><code>class DemonstrateScopingProblems {
      private status = &quot;blah&quot;;
      public run() {
          alert(this.status);
      }
  }
  
  var thisTest = new DemonstrateScopingProblems();
  // works as expected, displays &quot;blah&quot;:
  thisTest.run(); 
  // doesn't work; this is scoped to be the document so this.status is undefined:
  $(document).ready(thisTest.run); 
  </code></pre>
  <p>Now, I could change the call to...</p>
  <pre><code>$(document).ready(thisTest.run.bind(thisTest));
  </code></pre>
  <p>...which does work. But it's kinda horrible. It means that code can all compile and work fine in some circumstances, but if we forget to bind the scope it will break.</p>
  <p>I would like a way to do it within the class, so that when using the class we don't need to worry about what &quot;this&quot; is scoped to.</p>
  <p>Any suggestions?</p>
  <h1>Update</h1>
  <p>Another approach that works is using the fat arrow:</p>
  <pre><code>class DemonstrateScopingProblems {
      private status = &quot;blah&quot;;
  
      public run = () =&gt; {
          alert(this.status);
      }
  }
  </code></pre>
  <p>Is that a valid approach?</p>