The response to validate
Type predicate indicating whether data is a VWRSearchResponse
isVWRSearchResponse({ products: [{ code: "NA3626344", baseProduct: "11805968" }] }); // true
isVWRSearchResponse({ products: [{ code: "NA3626344" }] }); // false (missing baseProduct)
export function isVWRSearchResponse(data: unknown): data is VWRSearchResponse {
return v.safeParse(vwrSearchResponseSchema, data).success;
}
Type guard validating a VWR product search response. Requires a
productsarray whose entries each carry at least acodeand abaseProductid (other fields are tolerated).