Skip to content

Emit enums as union types instead of current string#221

Merged
mhegazy merged 7 commits into
microsoft:masterfrom
saschanaz:enums
Mar 30, 2017
Merged

Emit enums as union types instead of current string#221
mhegazy merged 7 commits into
microsoft:masterfrom
saschanaz:enums

Conversation

@saschanaz
Copy link
Copy Markdown
Collaborator

Fixes #200

Current:

interface Request extends Object, Body {
    readonly cache: string;
    readonly credentials: string;
    readonly destination: string;
    readonly headers: Headers;
    readonly integrity: string;
    readonly keepalive: boolean;
    readonly method: string;
    readonly mode: string;
    readonly redirect: string;
    readonly referrer: string;
    readonly referrerPolicy: string;
    readonly type: string;
    readonly url: string;
    clone(): Request;
}

Fixed:

interface Request extends Object, Body {
    readonly cache: RequestCache;
    readonly credentials: RequestCredentials;
    readonly destination: RequestDestination;
    readonly headers: Headers;
    readonly integrity: string;
    readonly keepalive: boolean;
    readonly method: string;
    readonly mode: RequestMode;
    readonly redirect: RequestRedirect;
    readonly referrer: string;
    readonly referrerPolicy: ReferrerPolicy;
    readonly type: RequestType;
    readonly url: string;
    clone(): Request;
}

type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin-only" | "origin-when-cross-origin" | "unsafe-url";
type RequestCache = "default" | "no-store" | "reload" | "no-cache" | "force-cache";
type RequestCredentials = "omit" | "same-origin" | "include";
type RequestDestination = "" | "document" | "sharedworker" | "subresource" | "unknown" | "worker";
type RequestMode = "navigate" | "same-origin" | "no-cors" | "cors";
type RequestRedirect = "follow" | "error" | "manual";
type RequestType = "" | "audio" | "font" | "image" | "script" | "style" | "track" | "video";

@saschanaz
Copy link
Copy Markdown
Collaborator Author

Will reopen after fixing build.

@saschanaz saschanaz closed this Mar 27, 2017
@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented Mar 29, 2017

@zhengbli can you please review this change?

@zhengbli
Copy link
Copy Markdown

LGTM

@zhengbli
Copy link
Copy Markdown

Thanks @saschanaz !

@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented Mar 30, 2017

We need to document this as a breaking change.

@mhegazy mhegazy merged commit 8053340 into microsoft:master Mar 30, 2017
@saschanaz saschanaz deleted the enums branch March 30, 2017 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants