TypeScript problem when using Metafield
type with MediaImage
reference.
#2196
-
I'm trying to assign the
My query looks pretty similar to the this. https://shopify.dev/api/hydrogen/utilities/parsemetafieldvalue Then I'm trying to access the image.
This throws the following when trying to access the image from
But the Can anyone see what I'm missing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
In this type of situation, I would say that trying to build your own Storefront API TypeScript type is kind of a code-smell; if you're not transforming the Storefront API response in any way, then your TS type for it should be the exact type that we provide. In order to best help you, it would help if we could see your exact query. But if you say it's similar to what you linked above, then you'll find that the metafield will be on But it's all hard to say without seeing a concrete example. |
Beta Was this translation helpful? Give feedback.
In this type of situation, I would say that trying to build your own Storefront API TypeScript type is kind of a code-smell; if you're not transforming the Storefront API response in any way, then your TS type for it should be the exact type that we provide.
In order to best help you, it would help if we could see your exact query. But if you say it's similar to what you linked above, then you'll find that the metafield will be on
product.metafield
and notproduct.image
.But it's all hard to say without seeing a concrete example.