Chok’s Typescript Utilities
    Preparing search index...

    Function isPromise

    • A type guard to check if an object is a Promise (or a "thenable"). It checks if the object is not null, is an object, and has a callable .then method.

      Note that if the Promise expects a certain type like Promise<T>, there is no way to validate the type of T unless we resolve the promise. This function does not attempt to typecheck for T in any way.

      Parameters

      • obj: unknown

      Returns obj is Promise<unknown>