Open obrassard opened 3 weeks ago
I thought this issue might be related to https://github.com/sanity-io/sanity/issues/6555 so I removed the => @
to test like this :
export const SanityProductModulesQuery = groq`
*[_type == 'product' && store.slug.current == $handle][0].modules[] {
_type == 'module.instagramBlock' => {
_key,
_type,
"title": title[$lang],
category,
},
_type == 'ref.module.textWithImageBlock' => {
_type,
_key,
_ref,
},
_type == 'ref.module.fullWidthTextBlock' => {
_type,
_key,
_ref,
}
}
`;
However, the result stays the same, and the generated Array type only contains the correct type for module.instagramBlock
(which is the only possible object in our schema).
I have the impression that the problem has more to do with the fact that we have several references with different names, and the parser doesn't resolve properly those custom _type
(eg _type == 'ref.module.textWithImageBlock'
)
Hi @sgulseth, unfortunately the issue persist event after upgrading to v3.49.0 :
⚡npx sanity versions
@sanity/cli (global) 3.49.0 (up to date)
@sanity/asset-utils 1.3.0 (up to date)
@sanity/color-input 3.1.1 (up to date)
@sanity/eslint-config-studio 4.0.0 (up to date)
@sanity/icons 3.2.0 (up to date)
@sanity/language-filter 4.0.2 (up to date)
@sanity/ui 2.6.1 (up to date)
@sanity/vision 3.49.0 (up to date)
sanity 3.49.0 (up to date)
I have a document containing an array field, mixing different types of reference and objects :
We fetch this data using a query like this :
The Generated Types for this query is incorrect :
The query itself work properly when tested in the vision plugin.
Which versions of Sanity are you using?
What operating system are you using? Mac OS 14.5 / Chrome
Which versions of Node.js / npm are you running?
NPM : 9.8.1 NODE : v18.18.2