Skip to content

Commit

Permalink
fix #2461: remove type param from axios such that responses and reque…
Browse files Browse the repository at this point in the history
…sts are all now mixed
  • Loading branch information
LoganBarnett committed Jul 4, 2018
1 parent f3c7f17 commit 25cd0eb
Show file tree
Hide file tree
Showing 11 changed files with 253 additions and 264 deletions.
48 changes: 24 additions & 24 deletions 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<T> {
declare interface AxiosXHRConfigBase {
headers?: Object;
maxContentLength?: number;
params?: Object;
Expand All @@ -10,59 +10,59 @@ declare module "axios" {
| "json"
| "text"
| "stream";
transformReponse?: <U>(data: T) => U;
transformRequest?: <U>(data: T) => U | Array<<U>(data: T) => U>;
transformResponse?: <U>(data: mixed) => U;
transformRequest?: <U>(data: mixed) => U | Array<<U>(data: mixed) => U>;
validateStatus?: ?(status: number) => boolean;
withCredentials?: boolean;
xsrfCookieName?: string;
xsrfHeaderName?: string;
}
declare interface AxiosXHRConfig<T> extends AxiosXHRConfigBase<T> {
data?: T;
declare interface AxiosXHRConfig extends AxiosXHRConfigBase {
data?: mixed;
method?: string;
url: string;
}
declare class AxiosXHR<T> {
config: AxiosXHRConfig<T>;
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<T> {
declare class AxiosRequestInterceptor {
use(
successHandler: ?(
response: AxiosXHRConfig<T>
) => Promise<AxiosXHRConfig<*>> | AxiosXHRConfig<*>,
response: AxiosXHRConfig
) => Promise<AxiosXHRConfig> | AxiosXHRConfig,
errorHandler: ?(error: mixed) => mixed
): AxiosInterceptorIdent;
eject(ident: AxiosInterceptorIdent): void;
}
declare class AxiosResponseInterceptor<T> {
declare class AxiosResponseInterceptor {
use(
successHandler: ?(response: AxiosXHR<T>) => mixed,
successHandler: ?(response: AxiosXHR) => mixed,
errorHandler: ?(error: mixed) => mixed
): AxiosInterceptorIdent;
eject(ident: AxiosInterceptorIdent): void;
}
declare class Axios {
constructor<T>(config: AxiosXHRConfigBase<T>): Promise<T>;
<T>(config: AxiosXHRConfigBase<T>): Promise<T>;
get: <T>(url: string, config?: AxiosXHRConfigBase<T>) => Promise<T>;
delete: <T>(url: string, config?: AxiosXHRConfigBase<T>) => Promise<T>;
head: <T>(url: string, config?: AxiosXHRConfigBase<T>) => Promise<T>;
post: <T>(
constructor(config: AxiosXHRConfigBase): Promise<AxiosXHR>;
(config: AxiosXHRConfigBase): Promise<AxiosXHR>;
get: (url: string, config?: AxiosXHRConfigBase) => Promise<AxiosXHR>;
delete: (url: string, config?: AxiosXHRConfigBase) => Promise<AxiosXHR>;
head: (url: string, config?: AxiosXHRConfigBase) => Promise<AxiosXHR>;
post: (
url: string,
data?: mixed,
config?: AxiosXHRConfigBase<T>
) => Promise<T>;
put: <T>(
config?: AxiosXHRConfigBase
) => Promise<AxiosXHR>;
put: (
url: string,
data?: mixed,
config?: AxiosXHRConfigBase<T>
) => Promise<T>;
config?: AxiosXHRConfigBase
) => Promise<AxiosXHR>;
interceptors: {
request: AxiosRequestInterceptor<mixed>,
response: AxiosResponseInterceptor<mixed>
Expand Down
68 changes: 34 additions & 34 deletions 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<T> {
adapter?: <T>(config: AxiosXHRConfig<T>) => Promise<AxiosXHR<T>>;
declare interface AxiosXHRConfigBase {
adapter?: (config: AxiosXHRConfig) => Promise<AxiosXHR>;
auth?: {
username: string,
password: string
Expand All @@ -13,8 +13,8 @@ declare module 'axios' {
params?: Object;
paramsSerializer?: (params: Object) => string;
responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream';
transformResponse?: Array<<U>(data: T) => U>;
transformRequest?: Array<<U>(data: T) => U|Array<<U>(data: T) => U>>;
transformResponse?: Array<<U>(data: mixed) => U>;
transformRequest?: Array<<U>(data: mixed) => U|Array<<U>(data: mixed) => U>>;
timeout?: number;
validateStatus?: (status: number) => boolean,
withCredentials?: boolean;
Expand All @@ -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<T> = AxiosXHRConfigBase<T>;
declare interface AxiosXHRConfig<T> extends AxiosXHRConfigBase<T> {
data?: T;
method?: string;
url: string;
}
declare type $AxiosXHRConfig<T> = AxiosXHRConfig<T>;
declare class AxiosXHR<T> {
config: AxiosXHRConfig<T>;
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<T> = $AxiosXHR<T>;
declare type $AxiosXHR = $AxiosXHR;
declare class AxiosInterceptorIdent extends String {}
declare class AxiosRequestInterceptor<T> {
declare class AxiosRequestInterceptor {
use(
successHandler: ?(response: AxiosXHRConfig<T>) => Promise<AxiosXHRConfig<*>> | AxiosXHRConfig<*>,
successHandler: ?(response: AxiosXHRConfig) => Promise<AxiosXHRConfig> | AxiosXHRConfig,
errorHandler: ?(error: mixed) => mixed,
): AxiosInterceptorIdent;
eject(ident: AxiosInterceptorIdent): void;
}
declare class AxiosResponseInterceptor<T> {
declare class AxiosResponseInterceptor {
use(
successHandler: ?(response: AxiosXHR<T>) => mixed,
successHandler: ?(response: AxiosXHR) => mixed,
errorHandler: ?(error: mixed) => mixed,
): AxiosInterceptorIdent;
eject(ident: AxiosInterceptorIdent): void;
}
declare type AxiosPromise<T> = Promise<AxiosXHR<T>>;
declare type AxiosPromise = Promise<AxiosXHR>;
declare class Axios {
constructor<T>(config?: AxiosXHRConfigBase<T>): void;
$call: <T>(config: AxiosXHRConfig<T> | string, config?: AxiosXHRConfig<T>) => AxiosPromise<T>;
request<T>(config: AxiosXHRConfig<T>): AxiosPromise<T>;
delete<T>(url: string, config?: AxiosXHRConfigBase<T>): AxiosPromise<T>;
get<T>(url: string, config?: AxiosXHRConfigBase<T>): AxiosPromise<T>;
head<T>(url: string, config?: AxiosXHRConfigBase<T>): AxiosPromise<T>;
post<T>(url: string, data?: mixed, config?: AxiosXHRConfigBase<T>): AxiosPromise<T>;
put<T>(url: string, data?: mixed, config?: AxiosXHRConfigBase<T>): AxiosPromise<T>;
patch<T>(url: string, data?: mixed, config?: AxiosXHRConfigBase<T>): AxiosPromise<T>;
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<mixed>,
response: AxiosResponseInterceptor<mixed>,
};
}

declare class AxiosError<T> extends Error {
config: AxiosXHRConfig<T>;
response: AxiosXHR<T>;
declare class AxiosError extends Error {
config: AxiosXHRConfig;
response: AxiosXHR;
code?: string;
}

declare type $AxiosError<T> = AxiosError<T>;
declare type $AxiosError = AxiosError;

declare interface AxiosExport extends Axios {
Axios: typeof Axios;
create(config?: AxiosXHRConfigBase<any>): Axios;
create(config?: AxiosXHRConfigBase): Axios;
all: typeof Promise.all;
spread(callback: Function): (arr: Array<any>) => Function
}
Expand Down
2 changes: 1 addition & 1 deletion definitions/npm/axios_v0.13.x/test_axios-v0.13.js
Expand Up @@ -31,7 +31,7 @@ axios.get('/user', {
ID: 12345
}
}).then((res) => {
res.data[0];
res.data;
});

// Send a POST request
Expand Down
86 changes: 43 additions & 43 deletions definitions/npm/axios_v0.15.x/flow_v0.25.x-v0.74.x/axios_v0.15.x.js
Expand Up @@ -21,8 +21,8 @@ declare module "axios" {
reason?: Cancel;
throwIfRequested(): void;
}
declare interface AxiosXHRConfigBase<T> {
adapter?: <T>(config: AxiosXHRConfig<T>) => Promise<AxiosXHR<T>>;
declare interface AxiosXHRConfigBase {
adapter?: (config: AxiosXHRConfig) => Promise<AxiosXHR>;
auth?: {
username: string,
password: string
Expand All @@ -46,86 +46,86 @@ declare module "axios" {
| "text"
| "stream";
timeout?: number;
transformRequest?: Array<<U>(data: T) => U | Array<<U>(data: T) => U>>;
transformResponse?: Array<<U>(data: T) => U>;
transformRequest?: Array<<U>(data: mixed) => U | Array<<U>(data: mixed) => U>>;
transformResponse?: Array<<U>(data: mixed) => U>;
validateStatus?: (status: number) => boolean;
withCredentials?: boolean;
xsrfCookieName?: string;
xsrfHeaderName?: string;
}
declare type $AxiosXHRConfigBase<T> = AxiosXHRConfigBase<T>;
declare interface AxiosXHRConfig<T> extends AxiosXHRConfigBase<T> {
data?: T;
method?: string;
url: string;
}
declare type $AxiosXHRConfig<T> = AxiosXHRConfig<T>;
declare class AxiosXHR<T> {
config: AxiosXHRConfig<T>;
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<T> = $AxiosXHR<T>;
declare type $AxiosXHR = $AxiosXHR;
declare type AxiosInterceptorIdent = number;
declare class AxiosRequestInterceptor<T> {
declare class AxiosRequestInterceptor {
use(
successHandler: ?(
response: AxiosXHRConfig<T>
) => Promise<AxiosXHRConfig<*>> | AxiosXHRConfig<*>,
response: AxiosXHRConfig
) => Promise<AxiosXHRConfig> | AxiosXHRConfig,
errorHandler: ?(error: mixed) => mixed
): AxiosInterceptorIdent;
eject(ident: AxiosInterceptorIdent): void;
}
declare class AxiosResponseInterceptor<T> {
declare class AxiosResponseInterceptor {
use(
successHandler: ?(response: AxiosXHR<T>) => mixed,
successHandler: ?(response: AxiosXHR) => mixed,
errorHandler: ?(error: mixed) => mixed
): AxiosInterceptorIdent;
eject(ident: AxiosInterceptorIdent): void;
}
declare type AxiosPromise<T> = Promise<AxiosXHR<T>>;
declare type AxiosPromise = Promise<AxiosXHR>;
declare class Axios {
constructor<T>(config?: AxiosXHRConfigBase<T>): void;
$call: <T>(
config: AxiosXHRConfig<T> | string,
config?: AxiosXHRConfig<T>
) => AxiosPromise<T>;
request<T>(config: AxiosXHRConfig<T>): AxiosPromise<T>;
delete<T>(url: string, config?: AxiosXHRConfigBase<T>): AxiosPromise<T>;
get<T>(url: string, config?: AxiosXHRConfigBase<T>): AxiosPromise<T>;
head<T>(url: string, config?: AxiosXHRConfigBase<T>): AxiosPromise<T>;
post<T>(
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<T>
): AxiosPromise<T>;
put<T>(
config?: AxiosXHRConfigBase
): AxiosPromise;
put(
url: string,
data?: mixed,
config?: AxiosXHRConfigBase<T>
): AxiosPromise<T>;
patch<T>(
config?: AxiosXHRConfigBase
): AxiosPromise;
patch(
url: string,
data?: mixed,
config?: AxiosXHRConfigBase<T>
): AxiosPromise<T>;
config?: AxiosXHRConfigBase
): AxiosPromise;
interceptors: {
request: AxiosRequestInterceptor<mixed>,
response: AxiosResponseInterceptor<mixed>
};
defaults: { headers: Object } & AxiosXHRConfig<*>;
}

declare class AxiosError<T> extends Error {
config: AxiosXHRConfig<T>;
response: AxiosXHR<T>;
declare class AxiosError extends Error {
config: AxiosXHRConfig;
response: AxiosXHR;
code?: string;
}

declare type $AxiosError<T> = AxiosError<T>;
declare type $AxiosError = AxiosError;

declare interface AxiosExport extends Axios {
Axios: typeof Axios;
Expand Down
2 changes: 1 addition & 1 deletion definitions/npm/axios_v0.15.x/test_axios-v0.15.js
Expand Up @@ -52,7 +52,7 @@ axios.get('/user', {
ID: 12345
}
}).then((res) => {
res.data[0];
res.data;
});

// Send a POST request
Expand Down

0 comments on commit 25cd0eb

Please sign in to comment.