fix(http): Update types for TypeScript nullability support

This commit is contained in:
Miško Hevery
2017-03-24 09:55:16 -07:00
committed by Tobias Bosch
parent 86396a43e9
commit c36ec9bf60
18 changed files with 138 additions and 128 deletions

View File

@ -36,13 +36,13 @@ export declare class CookieXSRFStrategy implements XSRFStrategy {
export declare class Headers {
constructor(headers?: Headers | {
[name: string]: any;
});
} | null);
append(name: string, value: string): void;
delete(name: string): void;
entries(): void;
forEach(fn: (values: string[], name: string, headers: Map<string, string[]>) => void): void;
get(name: string): string;
getAll(name: string): string[];
forEach(fn: (values: string[], name: string | undefined, headers: Map<string, string[]>) => void): void;
get(name: string): string | null;
getAll(name: string): string[] | null;
has(name: string): boolean;
keys(): string[];
set(name: string, value: string | string[]): void;
@ -137,13 +137,13 @@ export declare enum RequestMethod {
/** @experimental */
export declare class RequestOptions {
body: any;
headers: Headers;
method: RequestMethod | string;
headers: Headers | null;
method: RequestMethod | string | null;
params: URLSearchParams;
responseType: ResponseContentType;
responseType: ResponseContentType | null;
/** @deprecated */ search: URLSearchParams;
url: string;
withCredentials: boolean;
url: string | null;
withCredentials: boolean | null;
constructor({method, headers, body, url, search, params, withCredentials, responseType}?: RequestOptionsArgs);
merge(options?: RequestOptionsArgs): RequestOptions;
}
@ -151,26 +151,26 @@ export declare class RequestOptions {
/** @experimental */
export interface RequestOptionsArgs {
body?: any;
headers?: Headers;
method?: string | RequestMethod;
headers?: Headers | null;
method?: string | RequestMethod | null;
params?: string | URLSearchParams | {
[key: string]: any | any[];
};
responseType?: ResponseContentType;
} | null;
responseType?: ResponseContentType | null;
/** @deprecated */ search?: string | URLSearchParams | {
[key: string]: any | any[];
};
url?: string;
withCredentials?: boolean;
} | null;
url?: string | null;
withCredentials?: boolean | null;
}
/** @experimental */
export declare class Response extends Body {
bytesLoaded: number;
headers: Headers;
headers: Headers | null;
ok: boolean;
status: number;
statusText: string;
statusText: string | null;
totalBytes: number;
type: ResponseType;
url: string;
@ -188,22 +188,22 @@ export declare enum ResponseContentType {
/** @experimental */
export declare class ResponseOptions {
body: string | Object | ArrayBuffer | Blob;
headers: Headers;
status: number;
url: string;
body: string | Object | ArrayBuffer | Blob | null;
headers: Headers | null;
status: number | null;
url: string | null;
constructor({body, status, headers, statusText, type, url}?: ResponseOptionsArgs);
merge(options?: ResponseOptionsArgs): ResponseOptions;
}
/** @experimental */
export interface ResponseOptionsArgs {
body?: string | Object | FormData | ArrayBuffer | Blob;
headers?: Headers;
status?: number;
statusText?: string;
type?: ResponseType;
url?: string;
body?: string | Object | FormData | ArrayBuffer | Blob | null;
headers?: Headers | null;
status?: number | null;
statusText?: string | null;
type?: ResponseType | null;
url?: string | null;
}
/** @experimental */
@ -224,7 +224,7 @@ export declare class URLSearchParams {
appendAll(searchParams: URLSearchParams): void;
clone(): URLSearchParams;
delete(param: string): void;
get(param: string): string;
get(param: string): string | null;
getAll(param: string): string[];
has(param: string): boolean;
replaceAll(searchParams: URLSearchParams): void;