/** * The React run boundary: one fiber per mount, interrupted on cleanup. * * `react` is an optional peer dependency; importing * `@micthiesen/mitools/react` requires React 19. Only `react` itself is * imported, never `react-dom`, so this works in any renderer. */ import { type Effect } from "effect"; import { type DependencyList } from "react"; import { type EffectRunner } from "../boundary/index.js"; /** The start/cleanup pair `useEffectFiber` hands to React's `useEffect`. */ export interface FiberLifecycle { /** * Fork the effect and return the cleanup that interrupts it, or `undefined` * when `make` returned `null` and there is nothing to run. */ readonly start: () => (() => void) | undefined; } /** * The whole of `useEffectFiber` minus React: call `make`, fork what it returns * on `runner`, and hand back a cleanup that interrupts the fiber. Exported so * the lifecycle can be tested without a renderer, and so a non-React caller * with the same mount/unmount shape can reuse it. * * The effect must not fail. Surface failures inside it (log, toast, see * `forkReported`) so nothing escapes as an unhandled defect. */ export declare function fiberLifecycle(make: () => Effect.Effect | null, runner: EffectRunner): FiberLifecycle; /** * Own one fiber per mount: fork on mount and on every dependency change, * interrupt on cleanup. Return `null` from `make` to run nothing for this * render. Pass `runner` to run against a specific `ManagedRuntime` (its * services then become available to the effect); omitted, the global runtime * is used. * * A thin wrapper over `fiberLifecycle`, which holds the actual behaviour and * is what the tests exercise. */ export declare function useEffectFiber(make: () => Effect.Effect | null, deps: DependencyList): void; export declare function useEffectFiber(make: () => Effect.Effect | null, deps: DependencyList, runner: EffectRunner): void;