axios.d.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Type definitions for Axios v0.8.1
  2. // Project: https://github.com/mzabriskie/axios
  3. declare var axios: axios.AxiosStatic
  4. declare module axios {
  5. interface AxiosRequestMethods {
  6. get(url: string, config?: any): axios.Promise;
  7. delete(url: string, config?: any): axios.Promise;
  8. head(url: string, config?: any): axios.Promise;
  9. post(url: string, data: any, config?: any): axios.Promise;
  10. put(url: string, data: any, config?: any): axios.Promise;
  11. patch(url: string, data: any, config?: any): axios.Promise;
  12. }
  13. interface AxiosStatic extends AxiosRequestMethods {
  14. (options: axios.RequestOptions): axios.Promise;
  15. create(defaultOptions?: axios.InstanceOptions): AxiosInstance;
  16. all(iterable: any): axios.Promise;
  17. spread(callback: any): axios.Promise;
  18. }
  19. interface AxiosInstance extends AxiosRequestMethods {
  20. request(options: axios.RequestOptions): axios.Promise;
  21. }
  22. interface Response {
  23. data?: any;
  24. status?: number;
  25. statusText?: string;
  26. headers?: any;
  27. config?: any;
  28. }
  29. interface Promise {
  30. then(onFulfilled:(response: axios.Response) => void): axios.Promise;
  31. catch(onRejected:(response: axios.Response) => void): axios.Promise;
  32. }
  33. interface InstanceOptions {
  34. transformRequest?: (data: any) => any;
  35. transformResponse?: (data: any) => any;
  36. headers?: any;
  37. timeout?: number;
  38. withCredentials?: boolean;
  39. responseType?: string;
  40. xsrfCookieName?: string;
  41. xsrfHeaderName?: string;
  42. paramsSerializer?: (params: any) => string;
  43. baseURL?: string;
  44. }
  45. interface RequestOptions extends InstanceOptions {
  46. url: string;
  47. method?: string;
  48. params?: any;
  49. data?: any;
  50. }
  51. }
  52. declare module "axios" {
  53. export = axios;
  54. }