We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
The typegen is returning the wrong type
To Reproduce
Steps to reproduce the behavior:
const howToTestPageQuery = groq`*[_type == "testingPage" && (language == $regionLanguage || language == $language || language == '${DEFAULT_LANGUAGE}') && !(_id match 'drafts*')]{ ${SORT_ORDER}, hero{ ${HERO} }, modules[]{ _key, _type, _type == "informationSection" => { title, cards }, _type == "featureSection" => { title, subtitle, features }, _type == "video" => { url, type, preview, meta, filename, id }, _type == "resultSection" => { title, subtitle, imageMobile, imageDesktop, button }, }, ${SEO}, } | order(sortOrder desc)[0] `;
export type TestingPage = { _id: string; _type: 'testingPage'; _createdAt: string; _updatedAt: string; _rev: string; store?: ManualSlug; seo?: SeoPage; hero?: Banner; modules?: Array< | { title?: string; cards?: Array<{ title?: string; text?: string; _key: string; }>; _type: 'informationSection'; _key: string; } | { title?: string; subtitle?: string; features?: Array< { _key: string; } & Feature >; _type: 'featureSection'; _key: string; } | { title?: string; subtitle?: string; button?: Link; imageDesktop?: ShopifyAsset; imageMobile?: ShopifyAsset; _type: 'resultSection'; _key: string; } | ({ _key: string; } & ShopifyAsset) >; language?: string; }; // Not part of this particular query but required to get the context export type ShopifyAsset = { _type: 'shopify.asset'; filename?: string; id?: string; meta?: ShopifyAssetMetadata; preview?: ShopifyAssetPreview; type?: string; url?: string; };
Expected behavior
The module should been of a _type video. So instead of:
_type
video
| ({ _key: string; } & ShopifyAsset)
I want to get the following:
| ({ _key: string; _type: 'video' } & Omit<ShopifyAsset, '_type'>)
Which versions of Sanity are you using?
@sanity/cli (global) 3.66.1 (latest: 3.68.3) sanity 3.51.0 (latest: 3.68.3)
What operating system are you using? Windows, Linux, and macOS
Which versions of Node.js / npm are you running?
10.5.0 v20.12.2
Additional context
If this is on my side, then I apologize in advance.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
The typegen is returning the wrong type
To Reproduce
Steps to reproduce the behavior:
Groq query
Generated type using `sanity typegen generate`
Expected behavior
The module should been of a
_type
video
.So instead of:
I want to get the following:
Which versions of Sanity are you using?
What operating system are you using?
Windows, Linux, and macOS
Which versions of Node.js / npm are you running?
Additional context
If this is on my side, then I apologize in advance.
The text was updated successfully, but these errors were encountered: