Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add types for fetch request options #15

Open
shoonia opened this issue Sep 25, 2019 · 0 comments
Open

Add types for fetch request options #15

shoonia opened this issue Sep 25, 2019 · 0 comments

Comments

@shoonia
Copy link

shoonia commented Sep 25, 2019

We use the wix-fetch with request options like credentials and see a lots of TS errors. May you add more request options to types and add more variants for better autocomplete.

And may you also change property body, headers etc... as a not required property.

For example:

type RequestMode = "cors" | "no-cors" | "same-origin";

type RequestCredentials = "omit" | "include" | "same-origin";

type RequestCache =
    "default"
    | "force-cache"
    | "no-cache"
    | "no-store"
    | "only-if-cached"
    | "reload";

type WixFetchRequest = {

    method?: string;

    headers?: object;

    body?: string;

    mode?: RequestMode;

    credentials?: RequestCredentials;

    cache?: RequestCache;
};

Thanks!

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

No branches or pull requests

1 participant