import { AsyncDestructor, Destructor } from '@synnaxlabs/x';
import { DependencyList } from 'react';
export type AsyncEffectCallback = (signal: AbortSignal) => Promise<void | Destructor | AsyncDestructor>;
/**
 * A React hook that runs an asynchronous effect with proper cleanup handling.
 *
 * This hook is similar to React's `useEffect` but designed for async operations.
 * It provides an AbortSignal for cancellation and handles both synchronous and
 * asynchronous cleanup functions.
 *
 * @param effect - The async effect function to run. Receives an AbortSignal for cancellation.
 * @param deps - Optional dependency array. The effect will re-run when dependencies change.
 *
 * @example
 * ```ts
 * useAsyncEffect(async (signal) => {
 *   const response = await fetch('/api/data', { signal });
 *   const data = await response.json();
 *   if (signal.aborted) return;
 *   setData(data);
 *
 *   return async () => {
 *     // Async cleanup
 *     await cleanup();
 *   };
 * }, []);
 * ```
 *
 * @example
 * ```ts
 * useAsyncEffect(async (signal) => {
 *   const subscription = observable.subscribe(data => {
 *     if (signal.aborted) return;
 *     setData(data);
 *   });
 *
 *   return () => {
 *     // Sync cleanup
 *     subscription.unsubscribe();
 *   };
 * }, [observable]);
 * ```
 */
export declare const useAsyncEffect: (effect: AsyncEffectCallback, deps?: DependencyList) => void;
//# sourceMappingURL=useAsyncEffect.d.ts.map