mono/packages/core/dist/lazy.d.ts
2025-01-28 13:42:22 +01:00

23 lines
640 B
TypeScript

export declare class Lazy<T> {
private readonly executor;
private _didRun;
private _value?;
private _error;
constructor(executor: () => T);
/**
* True if the lazy value has been resolved.
*/
get hasValue(): boolean;
/**
* Get the wrapped value.
*
* This will force evaluation of the lazy value if it has not been resolved yet. Lazy values are only
* resolved once. `getValue` will re-throw exceptions that are hit while resolving the value
*/
get value(): T;
/**
* Get the wrapped value without forcing evaluation.
*/
get rawValue(): T | undefined;
}