API Reference / @evolu/common / Function / LazyValue
Type Alias: LazyValue()<T>
type LazyValue<T> = () => T;
Defined in: packages/common/src/Function.ts:52
A function that delays computation and returns a value of type T.
Useful for:
- Lazy evaluation
- Returning constant values
- Providing default or placeholder behaviors
Example
const getRandomNumber: LazyValue<number> = () => Math.random();
const randomValue = getRandomNumber();
Type Parameters
Type Parameter |
---|
T |
Returns
T