/** Options for creating an eager reactive effect. */ export interface CreateEffectOptions { /** The initial input passed to the first execution instead of `undefined`. */ initial?: Init; } /** * Callback context passed to an effect execution. */ export interface EffectContext { /** The previous effect result or the configured initial input. */ previous: Value; /** * Registers cleanup work to run before the next effect execution and when the effect is disposed. * * @param cleanup - The cleanup callback. */ onCleanup(cleanup: () => void): void; } /** * Handle returned by {@link createEffect} for manual disposal. */ export interface Effect extends Disposable { } /** * Effect callback receiving the previous return value and cleanup registrar through a context object. * * @param context - The effect execution context. * @returns The next effect result. */ export type EffectFunction = (context: EffectContext) => Next; /** * Creates an eager reactive effect. * * The effect runs immediately once and then reruns synchronously whenever one of the dependencies read during its last execution changed. * * The return value of each execution is passed into the next execution as `context.previous`. When `options.initial` is set, the first * execution receives that value instead of `undefined`. * * `context.onCleanup` registers callbacks that run before the next execution and when the effect is disposed. * * Effects return an explicit handle for manual disposal and additionally register their cleanup on the active scope, if there is one. * * @param func - The effect body to execute. * @param options - Optional effect behavior overrides. * @returns An effect handle for manual disposal. */ export declare function createEffect(func: EffectFunction, options?: CreateEffectOptions): Effect; export declare function createEffect(func: EffectFunction, options: CreateEffectOptions & { initial: Init; }): Effect;