The response to validate
Whether the response carries a list of nodes
isShopifyNodesResponse({ data: { nodes: [null] } }); // true
isShopifyNodesResponse({ errors: [] }); // false
export function isShopifyNodesResponse(
response: unknown,
): response is { data: { nodes: unknown[] } } {
return v.is(shopifyNodesResponseSchema, response);
}
Type guard for a Storefront API
nodes(ids:)response. The nodes themselves are not checked: a missing product isnullthere.