title: How should I define the callbacks with $http when using Typescript?
body: <p>My $http call looks like this and I would like to know the most flexible way to handle all of the parameters that are returned in the .success and .error?</p>
  
  <pre><code>this.$http({ url: "/api/x, method: "GET" })
     .success((??) : void =&gt; {
  
     })
     .error((??) : void =&gt; {
  
     })
  </code></pre>
  
  <p>The Angular documentation tells me the following are returned:</p>
  
  <pre><code>data – {string|Object} – The response body transformed with the transform functions.
  status – {number} – HTTP status code of the response.
  headers – {function([headerName])} – Header getter function.
  config – {Object} – The configuration object that was used to generate the request.
  statusText – {string} – HTTP status text of the response.
  </code></pre>
  
  <p>angular.d.ts shows me:</p>
  
  <pre><code>interface IHttpPromiseCallback&lt;T&gt; {
          (data: T, status: number, headers: (headerName: string) =&gt; string, config: IRequestConfig): void;
      }
  
      interface IHttpPromiseCallbackArg&lt;T&gt; {
          data?: T;
          status?: number;
          headers?: (headerName: string) =&gt; string;
          config?: IRequestConfig;
          statusText?: string;
      }
  </code></pre>
  
  <p>But I am still confused. Has anyone used the two interfaces above to define the callbacks and how did they do it?</p>
  
  <p>Ideally I would like to have something like this:</p>
  
  <pre><code> .success((data: any, status: number, headers: (headerName: string) =&gt; string, config: any) : void =&gt; {
  </code></pre>
  
  <p>But using the interfaces. </p>
  
  <p>Can anyone tell me if I am on the right track and if I could use the interfaces rather than having to specify the :any :number etc after the parameters.</p>