-
Notifications
You must be signed in to change notification settings - Fork 32
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
Sanity client: Expected 0 arguments, but got 1 #882
Comments
I tried with older version |
I am also experiencing the same issue with fresh install of 6.21.3. |
@cadyfatcat I was experiencing this with v6.21.3 as well! However, I managed to get things working on my end by going back a version to v6.1.4. |
Could you try using casting instead of the generic?: -const sectionData = await cmsClient.fetch<any>(query);
+const sectionData = await cmsClient.fetch(query) as Promise<any>; Although you shouldn't need to cast to any at all as that's the default value: -const sectionData = await cmsClient.fetch<any>(query);
+const sectionData = await cmsClient.fetch(query); The generics for |
Describe the bug
I have created a sanity client by using
createClient()
but when I tried to use it to fetch data I'm gettingExpected 0 arguments, but got 1
forfecth()
method.To Reproduce
Steps to reproduce the behavior:
I'm using typescript
"typescript": "^4.9.5"
with react.I have defined the client like this. in
sanity.ts
file.(the configurations are there. Confirmed by console log)
And I have used the client in
sanity.service.ts
but I'm getting
Expected behavior
Able to fetch data.
Which versions of Sanity are you using?
"@sanity/client": "^6.21.3"
What operating system are you using?
Windows 11
Which versions of Node.js / npm are you running?
Node v20.11.1
Npm v10.8.1
The text was updated successfully, but these errors were encountered: