ImageWithPreview Fragment on Array
logemann opened this issue · comments
Is there an easy solution to use this fragment in an array of images? This example is easy with a single image:
headlineImage {
...ImageWithPreview
}
But what about
entityImages {
...ImageWithPreview
}
This doesnt work cause i get:
Fragment "ImageWithPreview" cannot be spread here as objects of type "SanitySalesEntityImage" can never be of type "SanityImage".
If i extract those properties from the Fragment and put it in the query, it works. So is there some easy workaround?
Thanks.
The issue here isn't so much that this an array of images, it's that the node type (SanitySalesEntityImage
) hasn't been configured as implementing the interface defined by gatsby-plugin-sanity-image. You'll want to update your configuration (in gatsby-config.js) to include SanitySalesEntityImage
in the customImageTypes
array, then restart.
More documentation and background context for this can be found here: Custom Sanity Image Types