ChemPal Documentation - v1.6.0
    Preparing search index...
    • This can be used to typeguard a SynthetikaProduct

      Parameters

      • data: unknown

        The data to typeguard

      Returns data is SynthetikaProduct

      True if the data is a SynthetikaProduct, false otherwise

      const product = { id: 1, name: "Product 1", url: "https://example.com" };
      if (isSynthetikaProduct(product)) {
      console.log(product.name);
      }
      export function isSynthetikaProduct(data: unknown): data is SynthetikaProduct {
      const check = v.safeParse(synthetikaProductResponseSchema, data);
      if (!check.success) {
      console.warn('isSynthetikaProduct: data is not a SynthetikaProduct', {
      data,
      check,
      issues: check.issues,
      });
      }
      return check.success;
      }