TypeGen define non-null for singletons in queries #7361
Unanswered
notflip
asked this question in
Sanity Studio Support
Replies: 1 comment 1 reply
-
I believe the answer is yes, there is a way. If you add this to your typegen command in
This of course only applies to items in schema where Although I am curious as to why the entire result of your query isn't |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using the following query to fetch a few singletons
The types of settings, socials and seo are singletons in my Sanity Studio (so they will always be defined)
However when using TypeGen the result is
Each of these items can be null, according to typegen, which causes a lot of if-checks in my vue code. Is there a way to tell TypeGen that these are singletons/always defined?
This is an example of my singleton code for SEO
Beta Was this translation helpful? Give feedback.
All reactions