Skip to main content
Module

x/rimbu/mod.ts>AsyncOptLazy.toPromise

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Latest
function AsyncOptLazy.toPromise
import { AsyncOptLazy } from "https://deno.land/x/rimbu@1.2.1/mod.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)

Type Parameters

T
optional
A extends any[] = []

Parameters

optLazy: AsyncOptLazy<T, A>
  • the AsyncOptLazy value of type T
...args: A
  • when needed, the extra arguments to pass to the lazy invocation

Returns

Promise<T>