import { AsyncState, AsyncMode, AsyncKey, CancellablePromise, SerializedAsyncState, PromiseWithState, AsyncOrPromise } from './types'; /** * Internal helpers for async module. * These are shared utilities used across multiple async functions. * @internal */ /** * Create an AbortError in a cross-platform way. * DOMException doesn't exist in React Native, so we create a compatible error. * @internal */ export declare function createAbortError(message?: string): Error; /** * Check if an error is an AbortError. * Works with both DOMException and custom AbortError. * @internal */ export declare function isAbortError(error: unknown): boolean; /** * Global cache for pending promises (used for Suspense support). * @internal */ export declare const pendingPromises: WeakMap, Promise>; /** * Get the pending promise for an async state (for Suspense). * Returns undefined if no pending promise. */ export declare function getPendingPromise(state: AsyncState): Promise | undefined; /** * Wraps a synchronous or async function to always return a Promise. * Ensures async execution even for synchronous functions. * @internal */ export declare function promiseTry(fn: () => T | PromiseLike): Promise>; /** * Create a cancellable promise with a cancel method. * @internal */ export declare function createCancellablePromise(promise: Promise, cancel: () => void): CancellablePromise; /** * Serialization method for AsyncState. * - Stale mode: always serialize as success (user opted into "keep data") * - Fresh mode: only serialize success state * @internal */ export declare function stateToJSON(this: AsyncState): SerializedAsyncState; /** * Check if value is an AsyncState. * @internal */ export declare function isAsyncState(value: unknown): value is AsyncState; /** * Check if value is AsyncOrPromise. * @internal */ export declare function isAsyncOrPromise(value: unknown): value is AsyncOrPromise; /** * Convert a PromiseLike to PromiseWithState. * @internal */ export declare function toPromiseWithState(promise: PromiseLike): PromiseWithState; /** * Result type for getData helper. * @internal */ export type GetDataResult = { ready: true; data: any; } | { ready: false; error: Error; } | { ready: false; promise: PromiseLike; } | { ready: false; status: "idle"; }; /** * Extract data from AsyncState or PromiseLike. * @internal */ export declare function getData(item: AsyncOrPromise, index: number | string): GetDataResult; //# sourceMappingURL=helpers.d.ts.map