mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 21:10:23 +00:00
Merge pull request #8327 from martine/whatwg-fetch-types
properly type string enums
This commit is contained in:
Vendored
+22
-19
@@ -8,32 +8,35 @@ declare class Request extends Body {
|
||||
method: string;
|
||||
url: string;
|
||||
headers: Headers;
|
||||
context: string|RequestContext;
|
||||
context: RequestContext;
|
||||
referrer: string;
|
||||
mode: string|RequestMode;
|
||||
credentials: string|RequestCredentials;
|
||||
cache: string|RequestCache;
|
||||
mode: RequestMode;
|
||||
credentials: RequestCredentials;
|
||||
cache: RequestCache;
|
||||
}
|
||||
|
||||
interface RequestInit {
|
||||
method?: string;
|
||||
headers?: HeaderInit|{ [index: string]: string };
|
||||
body?: BodyInit;
|
||||
mode?: string|RequestMode;
|
||||
credentials?: string|RequestCredentials;
|
||||
cache?: string|RequestCache;
|
||||
mode?: RequestMode;
|
||||
credentials?: RequestCredentials;
|
||||
cache?: RequestCache;
|
||||
}
|
||||
|
||||
declare enum RequestContext {
|
||||
"audio", "beacon", "cspreport", "download", "embed", "eventsource", "favicon", "fetch",
|
||||
"font", "form", "frame", "hyperlink", "iframe", "image", "imageset", "import",
|
||||
"internal", "location", "manifest", "object", "ping", "plugin", "prefetch", "script",
|
||||
"serviceworker", "sharedworker", "subresource", "style", "track", "video", "worker",
|
||||
"xmlhttprequest", "xslt"
|
||||
}
|
||||
declare enum RequestMode { "same-origin", "no-cors", "cors" }
|
||||
declare enum RequestCredentials { "omit", "same-origin", "include" }
|
||||
declare enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" }
|
||||
type RequestContext =
|
||||
"audio" | "beacon" | "cspreport" | "download" | "embed" |
|
||||
"eventsource" | "favicon" | "fetch" | "font" | "form" | "frame" |
|
||||
"hyperlink" | "iframe" | "image" | "imageset" | "import" |
|
||||
"internal" | "location" | "manifest" | "object" | "ping" | "plugin" |
|
||||
"prefetch" | "script" | "serviceworker" | "sharedworker" |
|
||||
"subresource" | "style" | "track" | "video" | "worker" |
|
||||
"xmlhttprequest" | "xslt";
|
||||
type RequestMode = "same-origin" | "no-cors" | "cors";
|
||||
type RequestCredentials = "omit" | "same-origin" | "include";
|
||||
type RequestCache =
|
||||
"default" | "no-store" | "reload" | "no-cache" |
|
||||
"force-cache" | "only-if-cached";
|
||||
|
||||
declare class Headers {
|
||||
append(name: string, value: string): void;
|
||||
@@ -58,7 +61,7 @@ declare class Response extends Body {
|
||||
constructor(body?: BodyInit, init?: ResponseInit);
|
||||
error(): Response;
|
||||
redirect(url: string, status: number): Response;
|
||||
type: string|ResponseType;
|
||||
type: ResponseType;
|
||||
url: string;
|
||||
status: number;
|
||||
ok: boolean;
|
||||
@@ -67,7 +70,7 @@ declare class Response extends Body {
|
||||
clone(): Response;
|
||||
}
|
||||
|
||||
declare enum ResponseType { "basic", "cors", "default", "error", "opaque" }
|
||||
type ResponseType = "basic" | "cors" | "default" | "error" | "opaque";
|
||||
|
||||
interface ResponseInit {
|
||||
status: number;
|
||||
|
||||
Reference in New Issue
Block a user