Skip to main content
Module

x/rimbu/mod.ts>OptLazy

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Latest
type alias OptLazy
Re-export
import { type OptLazy } from "https://deno.land/x/rimbu@1.2.1/mod.ts";

A potentially lazy value of type T.

Type Parameters

T
optional
A extends any[] = []
definition: T | ((...args: A) => T)
function OptLazy
Re-export
import { OptLazy } from "https://deno.land/x/rimbu@1.2.1/mod.ts";

Returns the value contained in an OptLazy instance of type T.

Examples

Example 1

OptLazy(1)              // => 1
OptLazy(() => 1)        // => 1
OptLazy(() => () => 1)  // => () => 1

Type Parameters

T
optional
A extends any[] = []

Parameters

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