Closed goodwin64 closed 1 year ago
Hi @goodwin64!
The Sanity
namespace is added by @sanity-codegen/types
, and then augmented by the types generated by the codegen (adding your namespace and your types).
So I would say that you need to make sure that:
@sanity-codegen/types
is installed as dev dependency (or at least present by some other dependency)tsconfig.json
Hope that helps!
(full disclaimer: I also have problems with certain typings, as stated here https://github.com/ricokahler/sanity-codegen/issues/298)
Heyyy @ochicf! Thanks for the reply!
We've made it a slightly different way eventually - moved our types to GraphQL schema so we just need to update it there (needed by arch req-s).
But yeah, compared to how easy it was to setup a Sanity client and fill in the content, the type-gen process feels a bit raw.
Closing as not relevant but feel free to reopen later/link other issues here.
Using the same approach as in README:
I do the same in my code but it doesn't give me proper types:
moreover, ESlint complains to the Sanity namespace being not found:![image](https://github.com/ricokahler/sanity-codegen/assets/10671879/692e2011-0045-42fb-a858-731db51e9834)
Are there any TS config changes needed to be done additionally to recognise the Sanity namespace?