export type SnapshotFn = (current: unknown, prev: unknown) => unknown; /** * Register a custom snapshot function for instances of a class. * The function receives the current value, the previous snapshot (or undefined), * and the recursive `snapshot` function for snapshotting nested values. * * Subclasses inherit the handler automatically via prototype lookup, so * registering once on a base class applies to all descendants. A descendant * can override by registering its own handler. * * Return `prev` when nothing has changed to preserve reference stability. * * @example * ```ts * registerCustomSnapshot(MyEntity, (current, prev, snapshot) => { * const name = snapshot(current.name, prev?.name); * const age = current.age; * if (prev && name === prev.name && age === prev.age) return prev; * return { name, age }; * }); * ``` */ export declare const registerCustomSnapshot: (ctor: new (...args: any[]) => T, snapshotFn: (current: T, prev: T | undefined, snapshot: SnapshotFn) => T) => void; /** * Recursively snapshot a value with structural sharing. * * - Plain objects and arrays are deep-cloned; unchanged subtrees keep the same reference. * - ReactivePromise instances are read (establishing deps) and flattened to a plain object. * - Class instances are returned as-is unless a custom handler is registered * for the class or any of its ancestors via `registerCustomSnapshot`. * - Primitives are returned directly. */ export declare function snapshot(currentValue: unknown, prevValue: unknown): unknown; //# sourceMappingURL=snapshot.d.ts.map