title: With TypeScript: unable to refer to 'this' (class) from inside a function
body: <p>I'm learning <code>TypeScript</code> and have the following class:</p>
  
  <pre><code>class DetailDriver {
  
      public get driver() {
          return super.getEntity();
      }
  
      public activate(): breeze.Promise {
          var id = this.driver.id(); // this refers to (class) DetailDriver
  
          return promise
              .then(getCertificate)
              .fail(somethingWrong);
  
          function getCertificate() {
              var id = this.driver.id(); // this refers to any
              return ...
          }
      }
  }
  </code></pre>
  
  <p>As you can see on the above code, the first call to <code>this</code> refers to my class <code>DetailDriver</code>. That's good. The second call to <code>this</code> (inside <code>getCertificate</code>) refers to <code>any</code>. That's not what I need. I need to refer to my class <code>DetailDriver</code>. </p>
  
  <p>How to proceed?</p>
  
  <p>Thanks.</p>