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
If you find a security vulnerability, do NOT open an issue. Email [email protected] instead.
Describe the bug
Doing a projection like this:
"categories": array::compact([ ...relatedProducts[]->{ _id, "title": coalesce(title, name), }, ...relatedIndustries[]->{ _id, "title": coalesce(title, page.title), }, ...relatedApplicationUseCases[]->{ _id, "title": coalesce(title), } ]),
Causes the type generated type to be:
({ _id: string; title: string; }[] | { _id: string; title: string | null; }[])[]
Whereas the data is correct with the objects in the top array:
categories: [ { _id: '31827a4f-1b1a-4eed-90e6-a1475bfd9250', title: 'MRU Marine' }, { _id: 'be1d8610-2df5-4867-8cfb-3651f8d21660', title: 'MRUs for Shipping' }, { _id: 'fce3bc20-41ca-4c1e-8a83-0c48499f3515', title: 'Wind energy' } ]
To Reproduce
Steps to reproduce the behavior:
Query something with an array field and spread the array into a constructed array in groq.
Expected behavior
Type looks the same as data when spreading arrays.
Which versions of Sanity are you using?
@sanity/cli (global) 3.70.0 (latest: 3.71.2) @sanity/icons 3.5.7 (up to date) @sanity/image-url 1.1.0 (up to date) @sanity/orderable-document-list 1.2.2 (up to date) @sanity/preview-url-secret 2.1.0 (latest: 2.1.3) @sanity/ui 2.11.1 (latest: 2.11.6) @sanity/vision 3.69.0 (latest: 3.71.2) @sanity/visual-editing 2.12.0 (latest: 2.12.9) sanity 3.70.0 (latest: 3.71.2)
What operating system are you using?
MacOS 14.3.1
Which versions of Node.js / npm are you running?
v20.11.0, pnpm 9.6.0
Run npm -v && node -v in the terminal and copy-paste the result here.
npm -v && node -v
The text was updated successfully, but these errors were encountered:
No branches or pull requests
If you find a security vulnerability, do NOT open an issue. Email [email protected] instead.
Describe the bug
Doing a projection like this:
Causes the type generated type to be:
Whereas the data is correct with the objects in the top array:
To Reproduce
Steps to reproduce the behavior:
Query something with an array field and spread the array into a constructed array in groq.
Expected behavior
Type looks the same as data when spreading arrays.
Which versions of Sanity are you using?
@sanity/cli (global) 3.70.0 (latest: 3.71.2)
@sanity/icons 3.5.7 (up to date)
@sanity/image-url 1.1.0 (up to date)
@sanity/orderable-document-list 1.2.2 (up to date)
@sanity/preview-url-secret 2.1.0 (latest: 2.1.3)
@sanity/ui 2.11.1 (latest: 2.11.6)
@sanity/vision 3.69.0 (latest: 3.71.2)
@sanity/visual-editing 2.12.0 (latest: 2.12.9)
sanity 3.70.0 (latest: 3.71.2)
What operating system are you using?
MacOS 14.3.1
Which versions of Node.js / npm are you running?
v20.11.0, pnpm 9.6.0
Run
npm -v && node -v
in the terminal and copy-paste the result here.The text was updated successfully, but these errors were encountered: