/** * Utility for wrapping functions while preserving original references. * * This allows wrapped and original functions to be treated as the same * for deduplication purposes (e.g., in trigger()). */ /** Symbol to mark the original function on wrapped functions */ export declare const ORIGINAL_FN: unique symbol; /** * Wrap a function while marking the original for later retrieval. * * @param originalFn - The original function to wrap * @param createWrapper - Factory function that receives the original and returns the wrapper * @returns The wrapper function with the original marked * * @example * ```ts * const original = (x: number) => x * 2; * const wrapped = wrapFn(original, (fn) => { * return (x: number) => { * console.log('calling...'); * return fn(x); * }; * }); * * unwrapFn(wrapped) === original; // true * ``` */ export declare function wrapFn(originalFn: T, createWrapper: (original: T) => T): T; /** * Unwrap a function to get its original reference. * If the function is not wrapped, returns the function itself. * * @param fn - The function to unwrap * @returns The original function or the function itself if not wrapped * * @example * ```ts * const original = (x: number) => x * 2; * const wrapped = wrapFn(original, (...args) => original(...args)); * * unwrapFn(wrapped) === original; // true * unwrapFn(original) === original; // true * ``` */ export declare function unwrapFn(fn: T): T; /** * Check if a function is wrapped. * * @param fn - The function to check * @returns true if the function has an original reference marked */ export declare function isWrappedFn(fn: Function): boolean; //# sourceMappingURL=fnWrapper.d.ts.map