title: Whats the purpose of typescript's __awaiter
body: <p>consider this simple class</p>
  
  <pre><code>class Test {
      private foo(): Promise&lt;void&gt; {
          return new Promise&lt;void&gt;((resolve, reject) =&gt; {
              resolve();
          });
      }
  
      private async bar() {
          await this.foo();
      }
  }
  </code></pre>
  
  <p>This get compiled into </p>
  
  <pre><code>var __awaiter = (this &amp;&amp; this.__awaiter) || function (thisArg, _arguments, P, generator) {
      return new (P || (P = Promise))(function (resolve, reject) {
          function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
          function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
          function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
          step((generator = generator.apply(thisArg, _arguments)).next());
      });
  };
  class Test {
      foo() {
          return new Promise((resolve, reject) =&gt; {
              resolve();
          });
      }
      bar() {
          return __awaiter(this, void 0, void 0, function* () {
              yield this.foo();
          });
      }
  }
  //# sourceMappingURL=Test.js.map
  </code></pre>
  
  <p>but ES6 supports the keyword await natively, why would typescript get rid of await and return another Promise wrapper? </p>
  
  <p>Whats the purpose of __awaiter </p>