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