🔎 Checks if the given value is a Promise object.

Syntax

TypeScript
import { isPromise } from '@opentf/std';

isPromise(val: unknown): val is Promise<unknown>

Parameters

  • val: The value to check.

Returns

true if the value is a Promise, false otherwise.

Examples

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

isPromise({}) //=> false
Last updated on
Edit this page