swr
swr copied to clipboard
useSWRMutation - Type error: Expected 2-3 arguments, but got 1.
info: v2.2.5
Bug report
I am not really sure if it's bug but I believe it to be a type bug.
Description / Observed Behavior
In my current project Nextjs 14.1.4, Typescript 5. I have successfully setup swr
with global swrConfig where I have added the fetcher and all is perfectly working as expected, except the type error Type error: Expected 2-3 arguments, but got 1.
that I'm getting since I am not passing the fetcher option.
Is there how I can extend the type declaration to make fetcher optional?
Thanks for the good work, SWR is a great tool.
Note: The code is working as expected, just the type.
After spending some time on this I was able to extend the type by adding the following line to this file swr.d.ts
;
But it will be cool if this can be made optional here