Skip to content

Allow fetchclient's data to be set to success type only #2047

@soartec-lab

Description

@soartec-lab

Background

In #1885, we defined the type of response's data and status as a combination.
When used with the fetch client, this is a more accurate type definition.

However, when used as an HTTP client such as swr or react-query, it becomes a union type of 200 and 400, and the type cannot be specified. And in those libraries, it is common to use exceptions for cases other than 200 and refer to data only when it is 200.

For example, swr:

https://swr.vercel.app/docs/error-handling

Proposal

There are cases where you want to define only 200 data as before and make only the status a union type, so by making these options selectable, we would like to maintain the format before #1885.

Metadata

Metadata

Assignees

Labels

fetchFetch client related issue

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions