The data to typeguard
True if the data is a SynthetikaProductPrice, false otherwise
const product = { price: { gross: { final: "100" }, net: { final: "90" } } };
if (isSynthetikaProductPrice(product.price)) {
console.log(product.price.gross.final);
}
export function isSynthetikaProductPrice(data: unknown): data is SynthetikaProductPrice {
return v.safeParse(synthetikaProductPriceSchema, data).success;
}
This can be used to typeguard the .price.gross and .price.net fields of a SynthetikaProduct