Skip to main content

isPromise

Callable

  • isPromise<T>(x: unknown): x is Promise<T>

  • Checks if x is a Promise.

    Example

    isPromise(Promise.resolve(1))
    // => true

    isPromise("foo")
    // => false

    Type parameters

    • T

    Parameters

    • x: unknown

      The value to check.

    Returns x is Promise<T>

    true if x is a Promise, false otherwise.