Skip to content

Add types for fetch request options #15

@shoonia

Description

@shoonia

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions