title: TypeScript - How can I access "this" in async method
body: <p>I have this piece of code:</p>
  
  <pre><code>export class Profile {
  
      private resource: Resource = new Resource();
  
  
      /**
       * Problem here
       */
      async initialize(): Promise&lt;void&gt; {
          console.log(this.resource);
  
          var html = await this.resource.fetch(true);
  
          const $profile = jQuery(html);
  
          console.log($profile.find("span.largetext"));
  
  
      }
  }
  </code></pre>
  
  <p>If you can see the line <code>console.log(this.resource)</code>, I get undefined. Can't async methods access the "this"?</p>
  
  <p>I also tested with <code>console.log(this)</code>, and it returns <code>Profile { }</code> in the web inspector.</p>
  
  <p>Is there a way I can access <code>this</code>?</p>