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
According to the document, populateCache is used to transform the updated data from server into a desired form.
So mutate's data argument must accept any type, but currently the argument only accepts the same type as the type of returned value of fetcher.
The error occurs just in bound mutate.
Global mutate has no problems with populateCache.
Bug report
Description / Observed Behavior
According to the document,
populateCache
is used to transform the updated data from server into a desired form.So
mutate
's data argument must accept any type, but currently the argument only accepts the same type as the type of returned value offetcher
.The error occurs just in bound mutate.
Global mutate has no problems with populateCache.
Expected Behavior
bound mutate accepts any type
Repro Steps / Code Example
I created code sandbox.
https://codesandbox.io/p/sandbox/swr-mutate-with-populatecache-type-error-9h9ynk?file=%2Fsrc%2FApp.tsx
I could see there is a red line which tells type error in the code sandbox below.
Additional Context
In the code sandbox, the version of code sandbox is
v2.2.5
, but I confirmed the error also occurs in the latest commit.The text was updated successfully, but these errors were encountered: