The response data to validate
Type predicate indicating if the data is a valid AmbeedProductStockResponse
if (isAmbeedProductStockResponse(data)) {
console.log(data.value[0].size, data.value[0].has_stock);
}
export function isAmbeedProductStockResponse(data: unknown): data is AmbeedProductStockResponse {
return v.safeParse(ambeedProductStockResponseSchema, data).success;
}
Type guard to validate the
webapi/v1/product_stockresponse shape — thevaluearray of per-size stock rows (each with asize, plus per-warehouse quantities and an optional aggregatehas_stockflag). An emptyvaluearray is valid (no stock data available).