The data to validate
True if the data matches the product details format
const details = await fetch('/api/product/list?code=B803083');
if (isMacklinProductDetails(details)) {
// TypeScript now knows details has all product information
console.log(details.product_price);
}
export function isMacklinProductDetails(data: unknown): data is MacklinProductDetails {
return v.safeParse(macklinProductDetailsSchema, data).success;
}
Validates if data matches the Macklin product details format. Product details contain comprehensive information about a specific product variant, including pricing, stock, and delivery information.