axios.d.ts 1.2 KB
Newer Older
M
mzabriskie 已提交
1
// Type definitions for Axios v0.6.0
2 3 4 5 6 7 8 9 10
// Project: https://github.com/mzabriskie/axios



declare var axios: axios.AxiosStatic

declare module axios {
  interface AxiosStatic {
    (options: axios.RequestOptions): axios.Promise;
M
mzabriskie 已提交
11 12 13 14 15 16
    get(url: string, config?: any): axios.Promise;
    delete(url: string, config?: any): axios.Promise;
    head(url: string, config?: any): axios.Promise;
    post(url: string, data: any, config?: any): axios.Promise;
    put(url: string, data: any, config?: any): axios.Promise;
    patch(url: string, data: any, config?: any): axios.Promise;
17 18 19 20 21 22 23 24 25 26 27 28
    all(iterable: any): axios.Promise;
    spread(callback: any): axios.Promise;
  }
  
  interface Response {
    data?: any;
    status?: number;
    headers?: any;
    config?: any;
  }

  interface Promise {
29 30
    then(onFulfilled:(response: axios.Response) => void): axios.Promise;
    catch(onRejected:(response: axios.Response) => void): axios.Promise;
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
  }

  interface RequestOptions {
    url: string;
    method?: string;
    transformRequest?: (data: any) => any;
    headers?: any;
    params?: any;
    data?: any;
    withCredentials?: boolean;
    responseType?: string;
    xsrfCookieName?: string;
    xsrfHeaderName?: string;
  }
}

declare module "axios" {
  export = axios;
}