-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: type error on updating cache with bound mutate #2975
Comments
I fixed the problem. I'm waiting for any comments and requests! |
Key5n
added a commit
to Key5n/swr
that referenced
this issue
Jun 17, 2024
…ue of different value is assigned to mutate issue: vercel#2975
Key5n
added a commit
to Key5n/swr
that referenced
this issue
Jun 17, 2024
…ue of different value is assigned to mutate issue: vercel#2975
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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=/src/App.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: