The value to validate
Type predicate indicating if the value is a valid ParsedPrice
const parsed = parsePrice('$1,234.56');
if (isParsedPrice(parsed)) {
console.log(parsed.currencyCode); // 'USD'
}
export function isParsedPrice(data: unknown): data is ParsedPrice {
return parsedPriceSchema.safeParse(data).success;
}
Type guard to validate if a value is a valid ParsedPrice object. Checks for the presence and correct types of currencyCode, currencySymbol, and price.