wix-incubator / corvid-types

Type definitions for Corvid by Wix
MIT License
5 stars 3 forks source link

Add types for fetch request options #15

Open shoonia opened 5 years ago

shoonia commented 5 years ago

We use thewix-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!