The response data to assert
Error if the data is not a valid AmbeedProductPriceResponse
assertIsAmbeedProductPriceResponse(response);
// response is now typed as AmbeedProductPriceResponse
console.log(response.value.proInfo.p_am);
export function assertIsAmbeedProductPriceResponse(
data: unknown,
): asserts data is AmbeedProductPriceResponse {
if (!isAmbeedProductPriceResponse(data)) {
throw new Error('assertIsAmbeedProductPriceResponse failed');
}
}
Type assertion to ensure the given data is a valid AmbeedProductPriceResponse. Throws an error if the data does not match the expected structure.