diff --git a/definitions/npm/axios_v0.11.x/flow_v0.25.x-v0.74.x/axios_v0.11.x.js b/definitions/npm/axios_v0.11.x/flow_v0.25.x-v0.74.x/axios_v0.11.x.js index 8d391eaf75..53b61f2ee9 100644 --- a/definitions/npm/axios_v0.11.x/flow_v0.25.x-v0.74.x/axios_v0.11.x.js +++ b/definitions/npm/axios_v0.11.x/flow_v0.25.x-v0.74.x/axios_v0.11.x.js @@ -1,5 +1,5 @@ declare module "axios" { - declare interface AxiosXHRConfigBase { + declare interface AxiosXHRConfigBase { headers?: Object; maxContentLength?: number; params?: Object; @@ -10,59 +10,59 @@ declare module "axios" { | "json" | "text" | "stream"; - transformReponse?: (data: T) => U; - transformRequest?: (data: T) => U | Array<(data: T) => U>; + transformResponse?: (data: mixed) => U; + transformRequest?: (data: mixed) => U | Array<(data: mixed) => U>; validateStatus?: ?(status: number) => boolean; withCredentials?: boolean; xsrfCookieName?: string; xsrfHeaderName?: string; } - declare interface AxiosXHRConfig extends AxiosXHRConfigBase { - data?: T; + declare interface AxiosXHRConfig extends AxiosXHRConfigBase { + data?: mixed; method?: string; url: string; } - declare class AxiosXHR { - config: AxiosXHRConfig; - data: T; + declare class AxiosXHR { + config: AxiosXHRConfig; + data: mixed; headers: Object; status: number; statusText: string; request: mixed; //this is the request object, not really typed currently. } declare class AxiosInterceptorIdent extends String {} - declare class AxiosRequestInterceptor { + declare class AxiosRequestInterceptor { use( successHandler: ?( - response: AxiosXHRConfig - ) => Promise> | AxiosXHRConfig<*>, + response: AxiosXHRConfig + ) => Promise | AxiosXHRConfig, errorHandler: ?(error: mixed) => mixed ): AxiosInterceptorIdent; eject(ident: AxiosInterceptorIdent): void; } - declare class AxiosResponseInterceptor { + declare class AxiosResponseInterceptor { use( - successHandler: ?(response: AxiosXHR) => mixed, + successHandler: ?(response: AxiosXHR) => mixed, errorHandler: ?(error: mixed) => mixed ): AxiosInterceptorIdent; eject(ident: AxiosInterceptorIdent): void; } declare class Axios { - constructor(config: AxiosXHRConfigBase): Promise; - (config: AxiosXHRConfigBase): Promise; - get: (url: string, config?: AxiosXHRConfigBase) => Promise; - delete: (url: string, config?: AxiosXHRConfigBase) => Promise; - head: (url: string, config?: AxiosXHRConfigBase) => Promise; - post: ( + constructor(config: AxiosXHRConfigBase): Promise; + (config: AxiosXHRConfigBase): Promise; + get: (url: string, config?: AxiosXHRConfigBase) => Promise; + delete: (url: string, config?: AxiosXHRConfigBase) => Promise; + head: (url: string, config?: AxiosXHRConfigBase) => Promise; + post: ( url: string, data?: mixed, - config?: AxiosXHRConfigBase - ) => Promise; - put: ( + config?: AxiosXHRConfigBase + ) => Promise; + put: ( url: string, data?: mixed, - config?: AxiosXHRConfigBase - ) => Promise; + config?: AxiosXHRConfigBase + ) => Promise; interceptors: { request: AxiosRequestInterceptor, response: AxiosResponseInterceptor diff --git a/definitions/npm/axios_v0.13.x/flow_v0.25.x-v0.74.x/axios_v0.13.x.js b/definitions/npm/axios_v0.13.x/flow_v0.25.x-v0.74.x/axios_v0.13.x.js index 381843b8f0..ac4cd5f65c 100644 --- a/definitions/npm/axios_v0.13.x/flow_v0.25.x-v0.74.x/axios_v0.13.x.js +++ b/definitions/npm/axios_v0.13.x/flow_v0.25.x-v0.74.x/axios_v0.13.x.js @@ -1,6 +1,6 @@ declare module 'axios' { - declare interface AxiosXHRConfigBase { - adapter?: (config: AxiosXHRConfig) => Promise>; + declare interface AxiosXHRConfigBase { + adapter?: (config: AxiosXHRConfig) => Promise; auth?: { username: string, password: string @@ -13,8 +13,8 @@ declare module 'axios' { params?: Object; paramsSerializer?: (params: Object) => string; responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'; - transformResponse?: Array<(data: T) => U>; - transformRequest?: Array<(data: T) => U|Array<(data: T) => U>>; + transformResponse?: Array<(data: mixed) => U>; + transformRequest?: Array<(data: mixed) => U|Array<(data: mixed) => U>>; timeout?: number; validateStatus?: (status: number) => boolean, withCredentials?: boolean; @@ -23,65 +23,65 @@ declare module 'axios' { httpAgent?: mixed; // Missing the type in the core flow node libdef httpsAgent?: mixed; // Missing the type in the core flow node libdef } - declare type $AxiosXHRConfigBase = AxiosXHRConfigBase; - declare interface AxiosXHRConfig extends AxiosXHRConfigBase { - data?: T; - method?: string; - url: string; - } - declare type $AxiosXHRConfig = AxiosXHRConfig; - declare class AxiosXHR { - config: AxiosXHRConfig; - data: T; + declare type $AxiosXHRConfigBase = AxiosXHRConfigBase; + declare type AxiosXHRConfig = { + data?: mixed, + method?: string, + url: string, + } & AxiosXHRConfigBase; + declare type $AxiosXHRConfig = AxiosXHRConfig; + declare class AxiosXHR { + config: AxiosXHRConfig; + data: mixed; headers: Object; status: number; statusText: string, request: http$ClientRequest | XMLHttpRequest } - declare type $AxiosXHR = $AxiosXHR; + declare type $AxiosXHR = $AxiosXHR; declare class AxiosInterceptorIdent extends String {} - declare class AxiosRequestInterceptor { + declare class AxiosRequestInterceptor { use( - successHandler: ?(response: AxiosXHRConfig) => Promise> | AxiosXHRConfig<*>, + successHandler: ?(response: AxiosXHRConfig) => Promise | AxiosXHRConfig, errorHandler: ?(error: mixed) => mixed, ): AxiosInterceptorIdent; eject(ident: AxiosInterceptorIdent): void; } - declare class AxiosResponseInterceptor { + declare class AxiosResponseInterceptor { use( - successHandler: ?(response: AxiosXHR) => mixed, + successHandler: ?(response: AxiosXHR) => mixed, errorHandler: ?(error: mixed) => mixed, ): AxiosInterceptorIdent; eject(ident: AxiosInterceptorIdent): void; } - declare type AxiosPromise = Promise>; + declare type AxiosPromise = Promise; declare class Axios { - constructor(config?: AxiosXHRConfigBase): void; - $call: (config: AxiosXHRConfig | string, config?: AxiosXHRConfig) => AxiosPromise; - request(config: AxiosXHRConfig): AxiosPromise; - delete(url: string, config?: AxiosXHRConfigBase): AxiosPromise; - get(url: string, config?: AxiosXHRConfigBase): AxiosPromise; - head(url: string, config?: AxiosXHRConfigBase): AxiosPromise; - post(url: string, data?: mixed, config?: AxiosXHRConfigBase): AxiosPromise; - put(url: string, data?: mixed, config?: AxiosXHRConfigBase): AxiosPromise; - patch(url: string, data?: mixed, config?: AxiosXHRConfigBase): AxiosPromise; + constructor(config?: AxiosXHRConfigBase): void; + $call: (config: AxiosXHRConfig | string, config?: AxiosXHRConfig) => AxiosPromise; + request(config: AxiosXHRConfig): AxiosPromise; + delete(url: string, config?: AxiosXHRConfigBase): AxiosPromise; + get(url: string, config?: AxiosXHRConfigBase): AxiosPromise; + head(url: string, config?: AxiosXHRConfigBase): AxiosPromise; + post(url: string, data?: mixed, config?: AxiosXHRConfigBase): AxiosPromise; + put(url: string, data?: mixed, config?: AxiosXHRConfigBase): AxiosPromise; + patch(url: string, data?: mixed, config?: AxiosXHRConfigBase): AxiosPromise; interceptors: { request: AxiosRequestInterceptor, response: AxiosResponseInterceptor, }; } - declare class AxiosError extends Error { - config: AxiosXHRConfig; - response: AxiosXHR; + declare class AxiosError extends Error { + config: AxiosXHRConfig; + response: AxiosXHR; code?: string; } - declare type $AxiosError = AxiosError; + declare type $AxiosError = AxiosError; declare interface AxiosExport extends Axios { Axios: typeof Axios; - create(config?: AxiosXHRConfigBase): Axios; + create(config?: AxiosXHRConfigBase): Axios; all: typeof Promise.all; spread(callback: Function): (arr: Array) => Function } diff --git a/definitions/npm/axios_v0.13.x/test_axios-v0.13.js b/definitions/npm/axios_v0.13.x/test_axios-v0.13.js index f8c3dedcbd..7746078c8e 100644 --- a/definitions/npm/axios_v0.13.x/test_axios-v0.13.js +++ b/definitions/npm/axios_v0.13.x/test_axios-v0.13.js @@ -31,7 +31,7 @@ axios.get('/user', { ID: 12345 } }).then((res) => { - res.data[0]; + res.data; }); // Send a POST request diff --git a/definitions/npm/axios_v0.15.x/flow_v0.25.x-v0.74.x/axios_v0.15.x.js b/definitions/npm/axios_v0.15.x/flow_v0.25.x-v0.74.x/axios_v0.15.x.js index 41e90088e0..67a96fae1c 100644 --- a/definitions/npm/axios_v0.15.x/flow_v0.25.x-v0.74.x/axios_v0.15.x.js +++ b/definitions/npm/axios_v0.15.x/flow_v0.25.x-v0.74.x/axios_v0.15.x.js @@ -21,8 +21,8 @@ declare module "axios" { reason?: Cancel; throwIfRequested(): void; } - declare interface AxiosXHRConfigBase { - adapter?: (config: AxiosXHRConfig) => Promise>; + declare interface AxiosXHRConfigBase { + adapter?: (config: AxiosXHRConfig) => Promise; auth?: { username: string, password: string @@ -46,72 +46,72 @@ declare module "axios" { | "text" | "stream"; timeout?: number; - transformRequest?: Array<(data: T) => U | Array<(data: T) => U>>; - transformResponse?: Array<(data: T) => U>; + transformRequest?: Array<(data: mixed) => U | Array<(data: mixed) => U>>; + transformResponse?: Array<(data: mixed) => U>; validateStatus?: (status: number) => boolean; withCredentials?: boolean; xsrfCookieName?: string; xsrfHeaderName?: string; } - declare type $AxiosXHRConfigBase = AxiosXHRConfigBase; - declare interface AxiosXHRConfig extends AxiosXHRConfigBase { - data?: T; - method?: string; - url: string; - } - declare type $AxiosXHRConfig = AxiosXHRConfig; - declare class AxiosXHR { - config: AxiosXHRConfig; - data: T; + declare type $AxiosXHRConfigBase = AxiosXHRConfigBase; + declare type AxiosXHRConfig = { + data?: mixed, + method?: string, + url: string, + } & AxiosXHRConfigBase; + declare type $AxiosXHRConfig = AxiosXHRConfig; + declare class AxiosXHR { + config: AxiosXHRConfig; + data: mixed; headers: Object; status: number; statusText: string; request: http$ClientRequest | XMLHttpRequest; } - declare type $AxiosXHR = $AxiosXHR; + declare type $AxiosXHR = $AxiosXHR; declare type AxiosInterceptorIdent = number; - declare class AxiosRequestInterceptor { + declare class AxiosRequestInterceptor { use( successHandler: ?( - response: AxiosXHRConfig - ) => Promise> | AxiosXHRConfig<*>, + response: AxiosXHRConfig + ) => Promise | AxiosXHRConfig, errorHandler: ?(error: mixed) => mixed ): AxiosInterceptorIdent; eject(ident: AxiosInterceptorIdent): void; } - declare class AxiosResponseInterceptor { + declare class AxiosResponseInterceptor { use( - successHandler: ?(response: AxiosXHR) => mixed, + successHandler: ?(response: AxiosXHR) => mixed, errorHandler: ?(error: mixed) => mixed ): AxiosInterceptorIdent; eject(ident: AxiosInterceptorIdent): void; } - declare type AxiosPromise = Promise>; + declare type AxiosPromise = Promise; declare class Axios { - constructor(config?: AxiosXHRConfigBase): void; - $call: ( - config: AxiosXHRConfig | string, - config?: AxiosXHRConfig - ) => AxiosPromise; - request(config: AxiosXHRConfig): AxiosPromise; - delete(url: string, config?: AxiosXHRConfigBase): AxiosPromise; - get(url: string, config?: AxiosXHRConfigBase): AxiosPromise; - head(url: string, config?: AxiosXHRConfigBase): AxiosPromise; - post( + constructor(config?: AxiosXHRConfigBase): void; + $call: ( + config: AxiosXHRConfig | string, + config?: AxiosXHRConfig + ) => AxiosPromise; + request(config: AxiosXHRConfig): AxiosPromise; + delete(url: string, config?: AxiosXHRConfigBase): AxiosPromise; + get(url: string, config?: AxiosXHRConfigBase): AxiosPromise; + head(url: string, config?: AxiosXHRConfigBase): AxiosPromise; + post( url: string, data?: mixed, - config?: AxiosXHRConfigBase - ): AxiosPromise; - put( + config?: AxiosXHRConfigBase + ): AxiosPromise; + put( url: string, data?: mixed, - config?: AxiosXHRConfigBase - ): AxiosPromise; - patch( + config?: AxiosXHRConfigBase + ): AxiosPromise; + patch( url: string, data?: mixed, - config?: AxiosXHRConfigBase - ): AxiosPromise; + config?: AxiosXHRConfigBase + ): AxiosPromise; interceptors: { request: AxiosRequestInterceptor, response: AxiosResponseInterceptor @@ -119,13 +119,13 @@ declare module "axios" { defaults: { headers: Object } & AxiosXHRConfig<*>; } - declare class AxiosError extends Error { - config: AxiosXHRConfig; - response: AxiosXHR; + declare class AxiosError extends Error { + config: AxiosXHRConfig; + response: AxiosXHR; code?: string; } - declare type $AxiosError = AxiosError; + declare type $AxiosError = AxiosError; declare interface AxiosExport extends Axios { Axios: typeof Axios; diff --git a/definitions/npm/axios_v0.15.x/test_axios-v0.15.js b/definitions/npm/axios_v0.15.x/test_axios-v0.15.js index 1d2dc54f53..6e21003394 100644 --- a/definitions/npm/axios_v0.15.x/test_axios-v0.15.js +++ b/definitions/npm/axios_v0.15.x/test_axios-v0.15.js @@ -52,7 +52,7 @@ axios.get('/user', { ID: 12345 } }).then((res) => { - res.data[0]; + res.data; }); // Send a POST request diff --git a/definitions/npm/axios_v0.16.x/flow_v0.75.x-/axios_v0.16.x.js b/definitions/npm/axios_v0.16.x/flow_v0.75.x-/axios_v0.16.x.js index 45e0f3f638..c516115f1b 100644 --- a/definitions/npm/axios_v0.16.x/flow_v0.75.x-/axios_v0.16.x.js +++ b/definitions/npm/axios_v0.16.x/flow_v0.75.x-/axios_v0.16.x.js @@ -21,8 +21,8 @@ declare module "axios" { reason?: Cancel; throwIfRequested(): void; } - declare interface AxiosXHRConfigBase { - adapter?: (config: AxiosXHRConfig) => Promise>; + declare interface AxiosXHRConfigBase { + adapter?: (config: AxiosXHRConfig) => Promise; auth?: { username: string, password: string @@ -46,97 +46,97 @@ declare module "axios" { | "text" | "stream"; timeout?: number; - transformRequest?: Array<(data: T) => U | Array<(data: T) => U>>; - transformResponse?: Array<(data: T) => U>; + transformRequest?: Array<(data: mixed) => U | Array<(data: mixed) => U>>; + transformResponse?: Array<(data: mixed) => U>; validateStatus?: (status: number) => boolean; withCredentials?: boolean; xsrfCookieName?: string; xsrfHeaderName?: string; } - declare type $AxiosXHRConfigBase = AxiosXHRConfigBase; - declare interface AxiosXHRConfig extends AxiosXHRConfigBase { - data?: T; - method?: string; - url: string; - } - declare type $AxiosXHRConfig = AxiosXHRConfig; - declare class AxiosXHR { - config: AxiosXHRConfig; - data: T; + declare type $AxiosXHRConfigBase = AxiosXHRConfigBase; + declare type AxiosXHRConfig = { + data?: mixed, + method?: string, + url: string, + } & AxiosXHRConfigBase; + declare type $AxiosXHRConfig = AxiosXHRConfig; + declare class AxiosXHR { + config: AxiosXHRConfig; + data: mixed; headers?: Object; status: number; statusText: string; request: http$ClientRequest | XMLHttpRequest; } - declare type $AxiosXHR = AxiosXHR; + declare type $AxiosXHR = AxiosXHR; declare type AxiosInterceptorIdent = number; - declare class AxiosRequestInterceptor { + declare class AxiosRequestInterceptor { use( successHandler: ?( - response: AxiosXHRConfig - ) => Promise> | AxiosXHRConfig<*>, + response: AxiosXHRConfig + ) => Promise | AxiosXHRConfig, errorHandler: ?(error: mixed) => mixed ): AxiosInterceptorIdent; eject(ident: AxiosInterceptorIdent): void; } - declare class AxiosResponseInterceptor { + declare class AxiosResponseInterceptor { use( - successHandler: ?(response: AxiosXHR) => mixed, - errorHandler: ?(error: $AxiosError) => mixed + successHandler: ?(response: AxiosXHR) => mixed, + errorHandler: ?(error: $AxiosError) => mixed ): AxiosInterceptorIdent; eject(ident: AxiosInterceptorIdent): void; } - declare type AxiosPromise = Promise>; + declare type AxiosPromise = Promise; declare class Axios { - constructor(config?: AxiosXHRConfigBase): void; - [[call]]( - config: AxiosXHRConfig | string, - config?: AxiosXHRConfig - ): AxiosPromise; - request(config: AxiosXHRConfig): AxiosPromise; - delete(url: string, config?: AxiosXHRConfigBase): AxiosPromise; - get(url: string, config?: AxiosXHRConfigBase): AxiosPromise; - head(url: string, config?: AxiosXHRConfigBase): AxiosPromise; - post( + constructor(config?: AxiosXHRConfigBase): void; + [[call]]( + config: AxiosXHRConfig | string, + config?: AxiosXHRConfig + ): AxiosPromise; + request(config: AxiosXHRConfig): AxiosPromise; + delete(url: string, config?: AxiosXHRConfigBase): AxiosPromise; + get(url: string, config?: AxiosXHRConfigBase): AxiosPromise; + head(url: string, config?: AxiosXHRConfigBase): AxiosPromise; + post( url: string, data?: mixed, - config?: AxiosXHRConfigBase - ): AxiosPromise; - put( + config?: AxiosXHRConfigBase + ): AxiosPromise; + put( url: string, data?: mixed, - config?: AxiosXHRConfigBase - ): AxiosPromise; - patch( + config?: AxiosXHRConfigBase + ): AxiosPromise; + patch( url: string, data?: mixed, - config?: AxiosXHRConfigBase - ): AxiosPromise; + config?: AxiosXHRConfigBase + ): AxiosPromise; interceptors: { - request: AxiosRequestInterceptor, - response: AxiosResponseInterceptor + request: AxiosRequestInterceptor, + response: AxiosResponseInterceptor }; - defaults: { headers: Object } & AxiosXHRConfig<*>; + defaults: { headers: Object } & AxiosXHRConfig; } - declare class AxiosError extends Error { - config: AxiosXHRConfig; - response: AxiosXHR; + declare class AxiosError extends Error { + config: AxiosXHRConfig; + response: AxiosXHR; code?: string; } - declare type $AxiosError = AxiosError; + declare type $AxiosError = AxiosError; declare interface AxiosExport extends Axios { - [[call]]( - config: AxiosXHRConfig | string, - config?: AxiosXHRConfig - ): AxiosPromise; + [[call]]( + config: AxiosXHRConfig | string, + config?: AxiosXHRConfig + ): AxiosPromise; Axios: typeof Axios; Cancel: Class; CancelToken: Class; isCancel(value: any): boolean; - create(config?: AxiosXHRConfigBase): Axios; + create(config?: AxiosXHRConfigBase): Axios; all: typeof Promise.all; spread(callback: Function): (arr: Array) => Function; } diff --git a/definitions/npm/axios_v0.16.x/test_axios-v0.16.js b/definitions/npm/axios_v0.16.x/test_axios-v0.16.js index 1d2dc54f53..6e21003394 100644 --- a/definitions/npm/axios_v0.16.x/test_axios-v0.16.js +++ b/definitions/npm/axios_v0.16.x/test_axios-v0.16.js @@ -52,7 +52,7 @@ axios.get('/user', { ID: 12345 } }).then((res) => { - res.data[0]; + res.data; }); // Send a POST request diff --git a/definitions/npm/axios_v0.17.x/flow_v0.75.x-/axios_v0.17.x.js b/definitions/npm/axios_v0.17.x/flow_v0.75.x-/axios_v0.17.x.js index 0bbb12543f..86dacba6e7 100644 --- a/definitions/npm/axios_v0.17.x/flow_v0.75.x-/axios_v0.17.x.js +++ b/definitions/npm/axios_v0.17.x/flow_v0.75.x-/axios_v0.17.x.js @@ -21,8 +21,8 @@ declare module "axios" { reason?: Cancel; throwIfRequested(): void; } - declare interface AxiosXHRConfigBase { - adapter?: (config: AxiosXHRConfig) => Promise>; + declare interface AxiosXHRConfigBase { + adapter?: (config: AxiosXHRConfig) => Promise; auth?: { username: string, password: string @@ -46,98 +46,98 @@ declare module "axios" { | "text" | "stream"; timeout?: number; - transformRequest?: Array<(data: T) => U | Array<(data: T) => U>>; - transformResponse?: Array<(data: T) => U>; + transformRequest?: Array<(data: mixed) => U | Array<(data: mixed) => U>>; + transformResponse?: Array<(data: mixed) => U>; validateStatus?: (status: number) => boolean; withCredentials?: boolean; xsrfCookieName?: string; xsrfHeaderName?: string; } - declare type $AxiosXHRConfigBase = AxiosXHRConfigBase; - declare interface AxiosXHRConfig extends AxiosXHRConfigBase { - data?: T; - method?: string; - url: string; - } - declare type $AxiosXHRConfig = AxiosXHRConfig; - declare class AxiosXHR { - config: AxiosXHRConfig; - data: T; + declare type $AxiosXHRConfigBase = AxiosXHRConfigBase; + declare type AxiosXHRConfig = { + data?: mixed, + method?: string, + url: string, + } & AxiosXHRConfigBase; + declare type $AxiosXHRConfig = AxiosXHRConfig; + declare class AxiosXHR { + config: AxiosXHRConfig; + data: mixed; headers?: Object; status: number; statusText: string; request: http$ClientRequest | XMLHttpRequest; } - declare type $AxiosXHR = AxiosXHR; + declare type $AxiosXHR = AxiosXHR; declare type AxiosInterceptorIdent = number; - declare class AxiosRequestInterceptor { + declare class AxiosRequestInterceptor { use( successHandler: ?( - response: AxiosXHRConfig - ) => Promise> | AxiosXHRConfig<*>, + response: AxiosXHRConfig + ) => Promise | AxiosXHRConfig, errorHandler: ?(error: mixed) => mixed ): AxiosInterceptorIdent; eject(ident: AxiosInterceptorIdent): void; } - declare class AxiosResponseInterceptor { + declare class AxiosResponseInterceptor { use( - successHandler: ?(response: AxiosXHR) => mixed, - errorHandler: ?(error: $AxiosError) => mixed + successHandler: ?(response: AxiosXHR) => mixed, + errorHandler: ?(error: $AxiosError) => mixed ): AxiosInterceptorIdent; eject(ident: AxiosInterceptorIdent): void; } - declare type AxiosPromise = Promise>; + declare type AxiosPromise = Promise; declare class Axios { - constructor(config?: AxiosXHRConfigBase): void; - [[call]]( - config: AxiosXHRConfig | string, - config?: AxiosXHRConfig - ): AxiosPromise; - request(config: AxiosXHRConfig): AxiosPromise; - delete(url: string, config?: AxiosXHRConfigBase): AxiosPromise; - get(url: string, config?: AxiosXHRConfigBase): AxiosPromise; - head(url: string, config?: AxiosXHRConfigBase): AxiosPromise; - post( + constructor(config?: AxiosXHRConfigBase): void; + [[call]]( + config: AxiosXHRConfig | string, + config?: AxiosXHRConfig + ): AxiosPromise; + request(config: AxiosXHRConfig): AxiosPromise; + delete(url: string, config?: AxiosXHRConfigBase): AxiosPromise; + get(url: string, config?: AxiosXHRConfigBase): AxiosPromise; + head(url: string, config?: AxiosXHRConfigBase): AxiosPromise; + post( url: string, data?: mixed, - config?: AxiosXHRConfigBase - ): AxiosPromise; - put( + config?: AxiosXHRConfigBase + ): AxiosPromise; + put( url: string, data?: mixed, - config?: AxiosXHRConfigBase - ): AxiosPromise; - patch( + config?: AxiosXHRConfigBase + ): AxiosPromise; + patch( url: string, data?: mixed, - config?: AxiosXHRConfigBase - ): AxiosPromise; + config?: AxiosXHRConfigBase + ): AxiosPromise; interceptors: { request: AxiosRequestInterceptor, response: AxiosResponseInterceptor }; - defaults: { headers: Object } & AxiosXHRConfig<*>; + defaults: { headers: Object } & AxiosXHRConfig; } - declare class AxiosError extends Error { - config: AxiosXHRConfig; + declare class AxiosError extends Error { + config: AxiosXHRConfig; request?: http$ClientRequest | XMLHttpRequest; - response?: AxiosXHR; + response?: AxiosXHR; code?: string; } - declare type $AxiosError = AxiosError; + declare type $AxiosError = AxiosError; declare interface AxiosExport extends Axios { - [[call]]( - config: AxiosXHRConfig | string, - config?: AxiosXHRConfig - ): AxiosPromise; + [[call]]( + config: AxiosXHRConfig | string, + config?: AxiosXHRConfig + ): AxiosPromise; Axios: typeof Axios; Cancel: Class; CancelToken: Class; isCancel(value: any): boolean; - create(config?: AxiosXHRConfigBase): Axios; + create(config?: AxiosXHRConfigBase): Axios; all: typeof Promise.all; spread(callback: Function): (arr: Array) => Function; } diff --git a/definitions/npm/axios_v0.17.x/test_axios-v0.17.js b/definitions/npm/axios_v0.17.x/test_axios-v0.17.js index 1d2dc54f53..6e21003394 100644 --- a/definitions/npm/axios_v0.17.x/test_axios-v0.17.js +++ b/definitions/npm/axios_v0.17.x/test_axios-v0.17.js @@ -52,7 +52,7 @@ axios.get('/user', { ID: 12345 } }).then((res) => { - res.data[0]; + res.data; }); // Send a POST request diff --git a/definitions/npm/axios_v0.18.x/flow_v0.75.x-/axios_v0.18.x.js b/definitions/npm/axios_v0.18.x/flow_v0.75.x-/axios_v0.18.x.js index 599265cd94..2c63c1cd70 100644 --- a/definitions/npm/axios_v0.18.x/flow_v0.75.x-/axios_v0.18.x.js +++ b/definitions/npm/axios_v0.18.x/flow_v0.75.x-/axios_v0.18.x.js @@ -1,6 +1,6 @@ declare module "axios" { - declare interface AxiosTransformer { - (data: T, headers?: Object): Object; + declare interface AxiosTransformer { + (data: mixed, headers?: Object): Object; } declare interface ProxyConfig { host: string; @@ -28,8 +28,8 @@ declare module "axios" { reason?: Cancel; throwIfRequested(): void; } - declare interface AxiosXHRConfigBase { - adapter?: (config: AxiosXHRConfig) => Promise>; + declare interface AxiosXHRConfigBase { + adapter?: (config: AxiosXHRConfig) => Promise; auth?: { username: string, password: string @@ -53,92 +53,93 @@ declare module "axios" { | "text" | "stream"; timeout?: number; - transformRequest?: AxiosTransformer | Array>; - transformResponse?: AxiosTransformer | Array>; + transformRequest?: AxiosTransformer | Array; + transformResponse?: AxiosTransformer | Array; validateStatus?: (status: number) => boolean; withCredentials?: boolean; xsrfCookieName?: string; xsrfHeaderName?: string; } - declare type $AxiosXHRConfigBase = AxiosXHRConfigBase; - declare interface AxiosXHRConfig extends AxiosXHRConfigBase { - data?: T; + declare type $AxiosXHRConfigBase = AxiosXHRConfigBase; + declare type AxiosXHRConfig = { + data?: mixed, method?: string; - url: string; - } - declare type $AxiosXHRConfig = AxiosXHRConfig; - declare class AxiosXHR { - config: AxiosXHRConfig; - data: R; + url: string, + } & AxiosXHRConfigBase; + + declare type $AxiosXHRConfig = AxiosXHRConfig; + declare class AxiosXHR { + config: AxiosXHRConfig; + data: mixed; headers?: Object; status: number; statusText: string; request: http$ClientRequest | XMLHttpRequest; } - declare type $AxiosXHR = AxiosXHR; + declare type $AxiosXHR = AxiosXHR; declare type AxiosInterceptorIdent = number; - declare class AxiosRequestInterceptor { + declare class AxiosRequestInterceptor { use( successHandler: ?( - response: AxiosXHRConfig - ) => Promise> | AxiosXHRConfig<*,*>, + response: AxiosXHRConfig + ) => Promise | AxiosXHRConfig, errorHandler: ?(error: mixed) => mixed ): AxiosInterceptorIdent; eject(ident: AxiosInterceptorIdent): void; } - declare class AxiosResponseInterceptor { + declare class AxiosResponseInterceptor { use( - successHandler: ?(response: AxiosXHR) => mixed, + successHandler: ?(response: AxiosXHR) => mixed, errorHandler: ?(error: $AxiosError) => mixed ): AxiosInterceptorIdent; eject(ident: AxiosInterceptorIdent): void; } - declare type AxiosPromise = Promise>; + declare type AxiosPromise = Promise; declare class Axios { - constructor(config?: AxiosXHRConfigBase): void; - [[call]](config: AxiosXHRConfig | string, config?: AxiosXHRConfig): AxiosPromise; - request(config: AxiosXHRConfig): AxiosPromise; - delete(url: string, config?: AxiosXHRConfigBase): AxiosPromise; - get(url: string, config?: AxiosXHRConfigBase): AxiosPromise; - head(url: string, config?: AxiosXHRConfigBase): AxiosPromise; - post( + constructor(config?: AxiosXHRConfigBase): void; + [[call]](config: AxiosXHRConfig | string, config?: AxiosXHRConfig): AxiosPromise; + request(config: AxiosXHRConfig): AxiosPromise; + delete(url: string, config?: AxiosXHRConfigBase): AxiosPromise; + get(url: string, config?: AxiosXHRConfigBase): AxiosPromise; + head(url: string, config?: AxiosXHRConfigBase): AxiosPromise; + post( url: string, data?: mixed, - config?: AxiosXHRConfigBase - ): AxiosPromise; - put( + config?: AxiosXHRConfigBase + ): AxiosPromise; + put( url: string, data?: mixed, - config?: AxiosXHRConfigBase - ): AxiosPromise; - patch( + config?: AxiosXHRConfigBase + ): AxiosPromise; + patch( url: string, data?: mixed, - config?: AxiosXHRConfigBase - ): AxiosPromise; + config?: AxiosXHRConfigBase + ): AxiosPromise; interceptors: { request: AxiosRequestInterceptor, response: AxiosResponseInterceptor }; - defaults: { headers: Object } & AxiosXHRConfig<*,*>; + defaults: { headers: Object } & AxiosXHRConfig; } - declare class AxiosError extends Error { - config: AxiosXHRConfig; + declare class AxiosError extends Error { + config: AxiosXHRConfig; request?: http$ClientRequest | XMLHttpRequest; - response?: AxiosXHR; + response?: AxiosXHR; code?: string; } - declare type $AxiosError = AxiosError; + declare type $AxiosError = AxiosError; declare interface AxiosExport extends Axios { - [[call]](config: AxiosXHRConfig | string, config?: AxiosXHRConfig): AxiosPromise; + [[call]](config: AxiosXHRConfig | string, config?: AxiosXHRConfig): AxiosPromise; Axios: typeof Axios; Cancel: Class; CancelToken: Class; isCancel(value: any): boolean; - create(config?: AxiosXHRConfigBase): Axios; + create(config?: AxiosXHRConfigBase): Axios; all: typeof Promise.all; spread(callback: Function): (arr: Array) => Function; } diff --git a/definitions/npm/axios_v0.18.x/test_axios_v0.18.x.js b/definitions/npm/axios_v0.18.x/test_axios_v0.18.x.js index c043a40a5c..b6c16814d7 100644 --- a/definitions/npm/axios_v0.18.x/test_axios_v0.18.x.js +++ b/definitions/npm/axios_v0.18.x/test_axios_v0.18.x.js @@ -53,7 +53,7 @@ axios.get('/user', { ID: 12345 } }).then((res) => { - res.data[0]; + res.data; }); // Send a POST request @@ -87,15 +87,3 @@ axios.all([ // $ExpectError (a: string); }) - -const promise1: AxiosPromise<{ foo: string }, { bar: string }> = axios({ url: '/', method: 'post', data: { foo: 'bar' }}) -promise1.then(({ data }) => { - (data.bar: string); - // $ExpectError - data.foo; -}); - -const promise2: AxiosPromise<{ foo: number }> = axios({ url: '/', method: 'post', data: { foo: 1 }}) -promise2.then(({ data }) => { - data.foo + 1; -});