title: typescript syntax angular2 promise then callback
body: <p>i'm new to typescript and i can't find an alternative to optimize a line of code as you can see below. I need to filter an array derived from a callback function that i pass to a promise.then()... </p>
  
  <pre><code>getAllItems(): Promise&lt;MyItem[]&gt; { 
      return this.http.get(this.itemsUrl).toPromise()
          .then(this.extractData)
          .catch(this.handleError);
  }
  
  getItem(id: number | string): Promise&lt;MyItem&gt; {
      var that = this; // i want to avoid to use this...
      return this.http.get(this.itemsUrl).toPromise()
          // ...just here
          .then(function(res) {               
              return that.extractData(res).filter(h =&gt; h.id === +id)[0];
          })
          .catch(this.handleError);
  }
  
  private extractData(res: Response) {
      let body = res.json();
      return body.data || { };
  }
  </code></pre>
  
  <p>Code above works well but i want to use a more short(more typescript i guess) syntax to achieve something like:</p>
  
  <pre><code>getItem(id: number | string): Promise&lt;MyItem&gt; {
      return this.http.get(this.itemsUrl).toPromise()
          // ... here again
          .then(this.extractData =&gt; result.filter(h =&gt; h.id === +id)[0])
          .catch(this.handleError);
  }
  </code></pre>
  
  <p>obviously it does not work...any suggestion please? Thanks.</p>