The unwrapped response data to validate
Type predicate indicating the data is a valid MacklinProductInfo
const data = await this.request("/api/product/info", { method: "POST", body: { item_code } });
if (isMacklinProductInfo(data)) {
builder.setMoleweight(data.item.chem_mw);
}
export function isMacklinProductInfo(data: unknown): data is MacklinProductInfo {
return v.safeParse(macklinProductInfoSchema, data).success;
}
Validates the
datapayload of the product info endpoint (POST /api/product/info). Confirmsitem.chem_mw(the molecular weight) is present so callers can safely read the chemistry fields.