Skip to main content

isPromise

a function that checks if the given argument is a Promise. If it is a Promise, it narrows down the type.


Interface

typescript
const isPromise: <T = any>(value: any) => value is Promise<T>

Usage

import { isPromise } from '@devgrace/utils';

isPromise(Promise.resolve()); // true

isPromise(() => {}); // false
isPromise('123'); // false
isPromise(true); // false
isPromise({}); // false
isPromise(null); // false