ChemPal Documentation - v0.0.13-beta.5
    Preparing search index...

    Function assertIsAmbeedProductListResponse

    • Type assertion to ensure the given data is a valid AmbeedProductListResponse. Throws an error if the data does not match the expected structure.

      Parameters

      • data: unknown

        The response data to assert

      Returns asserts data is AmbeedProductListResponse

      Error if the data is not a valid AmbeedProductListResponse

      try {
      assertIsAmbeedProductListResponse(data);
      // data is now typed as AmbeedProductListResponse
      console.log(data.value);
      } catch (error) {
      console.error("Invalid Ambeed response:", error.message);
      }
      export function assertIsAmbeedProductListResponse(
      data: unknown,
      ): asserts data is AmbeedProductListResponse {
      if (!isAmbeedProductListResponse(data)) {
      throw new Error("assertIsAmbeedProductListResponse failed");
      }
      }