Closed lukastransom closed 2 years ago
I experienced the same problem, and solved it by adding this snippet to package.json
:
"resolutions": {
"@sanity/client": "^3.1.0"
}
However, this might have negative side effects, so I think that a much better solution is that sanity-algolia
releases a new version with updates dependencies.
@lukastransom, Did anything work for you regarding a solution? I ran into the same error. Also, would you mind posting the basics of your projection? I'd like to compare to my setup if possible.
@lukastransom Have you installed @sanity/client
as a dependency in your project? Since you are directly using it yourself you should also declare it as a direct dependency and import resolution should pick it up. These other sanity clients that next-sanity and sanity-algolia uses are of different versions and used by them internally.
@3200pro Since it's just a TS error (the JS code itself works fine), I ended up just adding a // @ts-nocheck
to the top of the file.
@runeb Yes, I'm seeing "@sanity/client": "^3.1.0"
in my dependencies
section of package.json
(indeed, in the front-end/non-studio portion of my repo). Even still, the TS error persists 😞 Let me know if there's anything else I should check!
@lukastransom Thanks for the update. I've released a new tagged version which seeks to clean up these dependency issues. Can you try
sanity-algolia@type-deps-fix
and let me know if that fixes your issues?
@runeb Thanks for the follow up—It worked!
I did npm i sanity-algolia@type-deps-fix
which boosted my version to "sanity-algolia": "^1.0.3"
, resulting in no more TS errors visible in VS Code or in my Vercel deploy builds.
Hey @runeb, the patched version does indeed fix the type error. Any chance you could get this published under latest
as well in order to make it default? :smile:
I'm getting this TypeScript error on the first parameter to the
webhookSync
method from thesanityAlgolia
instance:I'm not sure if this is a
next-sanity
issue or asanity-algolia
issue. I'm only importing from@sanity/client
(notnext-sanity
). Any ideas as to why it's referencing two different paths? Why should the path be relevant to the type?"/Users/lut/webdev/sanity/restaurant-project/node_modules/@sanity/client/sanityClient"
vs"/Users/lut/webdev/sanity/restaurant-project/node_modules/next-sanity/node_modules/@sanity/client/sanityClient"
My
pages/api/search/webhook.ts
looks like this:This was working, but now the TS errors are failing the build so it can't deploy from Vercel.