Updated types

This commit is contained in:
delvedor
2019-03-11 17:12:31 +01:00
parent cae38e6b2b
commit 46df19fd7d
4 changed files with 50 additions and 41 deletions

34
lib/Transport.d.ts vendored
View File

@ -49,25 +49,29 @@ interface TransportOptions {
headers?: anyObject;
}
export interface ApiResponse {
export interface RequestEvent {
body: any;
statusCode: number | null;
headers: any;
warnings: any[] | null;
headers: anyObject | null;
warnings: string[] | null;
meta: {
request: {
params: TransportRequestParams;
options: TransportRequestOptions;
};
connection: Connection;
attempts: number;
aborted: boolean;
sniff?: {
hosts: any[];
reason: string;
};
};
}
export interface EventMeta {
connection: Connection;
request: any;
response: ApiResponse;
attempts: number;
aborted: boolean;
}
export interface SniffMeta {
hosts: any[];
reason: string;
}
// ApiResponse and RequestEvent are the same thing
// we are doing this for have more clear names
export interface ApiResponse extends RequestEvent {}
declare type anyObject = {
[key: string]: any;