This gives me "Property 'data' does not exist on type 'void'.ts(2339)": const fetcher =…
- User
This gives me "Property 'data' does not exist on type 'void'.ts(2339)":
const fetcher = (query: string) => fetchGraphQL(query, { categoryEntityId: 23, }).then((res) => { const products: Product[] = res.data?.site?.search?.searchProducts?.products?.edges || []; return products; });
- Assistant
The error message is indicating that the
resobject does not have adataproperty, which is likely because thefetchGraphQLfunction is not returning the expected data.To fix this, you should make sure that the
fetchGraphQLfunction is returning a promise that resolves to an object with adataproperty. Here's an example of how you could modify thefetcherfunction to handle this:typescript
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.