effect-io-ai

Package: effect
Module: Predicate

Predicate.isPromise

Checks whether a value is a Promise-like object with then and catch.

When to use

Use when you need a Predicate guard for promise instances across realms.

Details

Performs a structural check for then and catch functions.

Example (Guarding promises)

import { Predicate } from "effect"

const data: unknown = Promise.resolve(1)

console.log(Predicate.isPromise(data))

See

Signature

declare const isPromise: (input: unknown) => input is Promise<unknown>

Source

Since v2.0.0