Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rimbu/common/internal.ts>AsyncOptLazy.toPromise

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
function AsyncOptLazy.toPromise
import { AsyncOptLazy } from "https://deno.land/x/rimbu@1.0.0/common/internal.ts";
const { toPromise } = AsyncOptLazy;

Returns the value contained in an AsyncOptLazy instance of type T as a promise.

Examples

Example 1

AsyncOptLazy.toPromise(1)              // => Promise(1)
AsyncOptLazy.toPromise(() => 1)        // => Promise(1)
AsyncOptLazy.toPromise(() => () => 1)  // => Promise(() => 1)
AsyncOptLazy.toPromise(async () => 1)  // => Promise(1)
AsyncOptLazy.toPromise(Promise.resolve(1))  // => Promise(1)

Parameters

optLazy: AsyncOptLazy<T>
  • the AsyncOptLazy value of type T

Returns

Promise<T>