You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However now the url and token are any and unknown respectively. Any extra arguments passed are also unknown instead of their actual type, eg. ['foobar.com', 1, false, 'foo'] results into string, unknown, unknown, unknown.
Expected Behavior
I'd expect that the data would be of type Foobar and the url and token parameters would be string and string.
Repro Steps / Code Example
Repro steps above.
Additional Context
SWR version: 2.2.5
This issue also makes it annoying to use a type fetcher, because there's no way to annotate the Error type.
The text was updated successfully, but these errors were encountered:
Bug report
Description / Observed Behavior
When looking at the documentation, one can either use a typed fetcher or type the
useSWR
hook directly. Let's try to implement thetoken
example from the same docs (https://swr.vercel.app/docs/arguments.en-US#multiple-arguments)If a typed fetcher is used, everything works just fine.
Everything works just fine here, the types passed into the fetcher are correctly set to
string
andstring
.However now the
error
return value isany
, but we can also type theuseSWR
hook:However now the
url
andtoken
areany
andunknown
respectively. Any extra arguments passed are alsounknown
instead of their actual type, eg.['foobar.com', 1, false, 'foo']
results intostring, unknown, unknown, unknown
.Expected Behavior
I'd expect that the
data
would be of typeFoobar
and theurl
andtoken
parameters would bestring
andstring
.Repro Steps / Code Example
Repro steps above.
Additional Context
SWR version: 2.2.5
This issue also makes it annoying to use a type fetcher, because there's no way to annotate the
Error
type.The text was updated successfully, but these errors were encountered: