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

x/rimbu/core/mod.ts>OptLazy

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
type alias OptLazy
Re-export
import { type OptLazy } from "https://deno.land/x/rimbu@1.2.0/core/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.0/core/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