title: Where and how to use HttpResponse in angular2
body: <p><code>HttpResponse</code> class(in <strong>@angular/common/http</strong>) is a replace of class <code>Response</code> of <strong>@angular/http</strong>(which is deprecated). Looking at docs don't give much idea of how and where to use it! Moreover, I tried to replace my old angular code but since this class is generic so it needs a type e.g. <code>HttpResponse&lt;T&gt;</code>. Giving it type  gives an error as :</p>
  
  <p><code>Property 'json' does not exist on type 'HttpResponse&lt;any&gt;'</code></p>
  
  <p>Can anyone please help me know how to use HttpResponse class in angular?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>This is my code snippet, a function 'get', that I made:</p>
  
  <pre><code>get(path: string, params: HttpParams = new HttpParams()): Observable&lt;any&gt; {
    return this.http.get(`${environment.api_url}${path}`, { headers: this.setHeaders(), search: params })
    .catch(this.formatErrors)
    .map((res: HttpResponse&lt;any&gt;) =&gt; res.json());
  </code></pre>