import { type IDisposable } from '../functions/disposer.js'; import type { IResettableModel } from '../models/types.js'; import type { IExpireTracker } from '../structures/expire.js'; import type { ILazy } from './types.js'; /** * Synchronous lazy-loading container that initializes a value on first access. * The value is cached until reset or expired. Supports custom disposal and cache expiration. */ export declare class Lazy implements ILazy, IDisposable, IResettableModel { protected readonly _factory: (() => T); protected _instance: T | undefined; private _expireTracker; private _disposer?; private _error; constructor(_factory: (() => T)); get hasValue(): boolean; get value(): T; get currentValue(): T | undefined; get error(): unknown; /** @deprecated Use {@link error} instead. */ get errorMessage(): string | null; /** Override me: additional way to make sure instance is valid */ protected get isValid(): boolean; /** Provides custom cleanup logic when the instance is reset or disposed. */ withDisposer(disposer: (prev: T) => void): this; /** Configures automatic cache expiration using an expire tracker. */ withExpire(tracker: IExpireTracker | undefined): this; /** Eagerly loads the value without accessing it. Useful for preloading. */ prewarm(): this; /** Manually sets the cached value. */ setInstance(instance: T | undefined): void; reset(): void; dispose(): void; private ensureInstance; }