Function isPromise

  • instanceof Promise alias.

    Example

    isPromise(new Promise()); // true
    isPromise((async () => {})()); // true
    isPromise(fetch("https://vangware.com")); // true
    isPromise(Promise.resolve("Vangware")); // true
    isPromise("Vangware"); // false

    Returns

    true if the given value is an instance of Promise, false otherwise.

    Type Parameters

    • Actual = unknown

    Parameters

    • input: Promise<unknown> | Actual

    Returns input is Promise<unknown>