Allow fetch
client's data
to be set to success type only
#2047
Labels
fetch
Fetch client related issue
fetch
client's data
to be set to success type only
#2047
Background
In #1885, we defined the type of
response
'sdata
andstatus
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
orreact-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 todata
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.
The text was updated successfully, but these errors were encountered: