@adviser/cement - v0.0.0
    Preparing search index...

    Function isPromise

    • Type guard to check if a value is a Promise or Promise-like (thenable).

      Checks both for instanceof Promise and for objects with then/catch/finally methods, allowing it to work with Promise-like objects from different execution contexts.

      Type Parameters

      • R extends Promise<T>

        The Promise type

      • T

        The resolved value type

      Parameters

      • a: unknown

        The value to check

      Returns a is R

      True if the value is a Promise or thenable

      const value: unknown = fetchData();
      if (isPromise(value)) {
      const result = await value;
      }