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
In v2.0.1, #2301 improved type support for suspense, so when we make suspense true, data can't be undefined. But when we use generics for useSWR, this type support become not working.
The same is true of fallbackData.
I think it is because TypeScript hasn't support partial type inferring of generics.
Expected Behavior
Even if we use generics, data must not be undefined.
And in this way, it work as we expect.
Repro Steps / Code Example
I attached images above.
Additional Context
SWR version: v2.0.3
The text was updated successfully, but these errors were encountered:
* fix SWROptions type
* add undefined to config type
* fix typo
* add test case for suspense
* add test case for fallbackdata
* add test case for config is undefined
---------
Co-authored-by: taro <taro.onishi@shelfy.jp>
… type (#2506)
* add test case
* Revert "Fix: type support for suspense and fallbackData(#2396) (#2452)"
This reverts commit 04df1bf.
* fix: better tests that now properly explain why partial type inferrence won't work in typescript
* add test for passing in a config of type SWRConfiguration
Bug report
Description / Observed Behavior
In v2.0.1, #2301 improved type support for
suspense
, so when we makesuspense
true,data
can't beundefined
. But when we use generics foruseSWR
, this type support become not working.The same is true of
fallbackData
.I think it is because TypeScript hasn't support partial type inferring of generics.
Expected Behavior
Even if we use generics,
data
must not beundefined
.And in this way, it work as we expect.

Repro Steps / Code Example
I attached images above.
Additional Context
SWR version: v2.0.3
The text was updated successfully, but these errors were encountered: