Skip to content

isPromise

isPromise<T>(x): 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.