import { A as AsyncState, F as Falsy } from '../types-5EvFF6wb.js'; import 'keyweaver'; import 'react'; declare const use: { /** * Hook to retrieve the current value of the loaded {@link state}. * If the {@link state} isn't loaded, the component using this hook suspends. * Ensure the component is wrapped in a component to handle the loading state. * If loading fails and {@link safeReturn} is not enabled, an error is thrown. * * @example * ```jsx * const DataComponent = () => { * const data = use(asyncState); // Suspends if not loaded * * return
Data: {JSON.stringify(data)}
; * }; * * const SafeComponent = () => { * const [data, error] = use(asyncState, true); // Safely returns a tuple * * if (error) { * return
Error: {error.message}
; * } * * return
Data: {JSON.stringify(data)}
; * }; * * const App = () => ( * <> * Loading...}> * * * Loading...}> * * * * ); * ``` */ (state: S, safeReturn?: SafeReturn): S extends AsyncState ? SafeReturn extends false ? T : Readonly<[value: T, error: undefined] | [value: undefined, error: E]> : undefined; }; export { use as default };