sanity-typed-queries
sanity-typed-queries copied to clipboard
docs: Resolve property from array of references.
📚 Is your documentation request related to a problem? Please describe.
I could totally be missing something - but I'd like to be able to construct the equivalent query to:
*[_type=='movie']{title,'cast': castMembers[]->name}
I would expect this to generate that:
const [query] = movie
.map(h => ({ cast: h.castMembers.resolve('name').use() }))
.pick(['title', 'cast'])
.use()
But it appears to generate:
*[_type=='movie']{title,'cast': castMembers->name}
Which, when leaving off the []
, doesn't produce the expected result.
🔍 Where should you find it?
I'd expect to find this on the cheat sheet: https://github.com/danielroe/sanity-typed-queries/blob/main/docs/cheat-sheet.md
ℹ️ Additional context
This library has been unbelievably useful - thank you so much for your work on this.