You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However when I add some sort of object inside the document and want to query for it it returns a never:
constproductSchema=defineType({name: 'product',type: 'document',title: 'Product',fields: [defineField({title: 'Name',name: 'name',type: 'string'}),defineField({title: 'Store',name: 'store',type: 'object',fields: [defineField({title: 'Name',name: 'name',type: 'string'})]})]})exportconstmakeTypedQuery=async()=>sanityClient.fetch('*[_type=="product" && store.name == $name]',{name: 'Search for a name'});asyncfunctiontest(){constres=awaitmakeTypedQuery();// never[]res[0].name// Property name does not exist on type never}
This is a simplified version, as I created custom objects and added them as types to the schemaTypes array. But it still gives a demonstration of the issue.
Am I missing something in my setup for this to work?
The text was updated successfully, but these errors were encountered:
studiodrimmel
changed the title
Multiple filters result in unknown responses
Addiuertng filters to GROQ-query results in never
Jan 23, 2024
studiodrimmel
changed the title
Addiuertng filters to GROQ-query results in never
Adding filters to GROQ-query results in never
Jan 23, 2024
studiodrimmel
changed the title
Adding filters to GROQ-query results in never
Adding a nested object filter to GROQ-query results in never
Jan 24, 2024
Sorry, I'm coming back to this after having had some of my own health issues. Is this still happening for you? If so, what is your version of typescript? It's important that it matches the versions of these libraries.
Hi!
First of all, thanks for the effort you've put into this!
Whenever I add a nested filter, the generated type is unknown and it only happens if it is a nested property. It always returns never[] / never
This works fine:
However when I add some sort of object inside the document and want to query for it it returns a never:
This is a simplified version, as I created custom objects and added them as types to the schemaTypes array. But it still gives a demonstration of the issue.
Am I missing something in my setup for this to work?
Cheers and kind regards,
Wesley
Rest of the file:
The text was updated successfully, but these errors were encountered: