import { type PartialWithUndefined } from '@augment-vir/common'; import { type AsyncProp } from './async-prop.js'; /** * Options for {@link renderAsync}. * * @category Internal */ export type RenderAsyncOptions = PartialWithUndefined<{ /** * When set to `true`, uses `lastResolvedValue` instead of `value` from the async prop. This is * useful when you want to keep showing the last resolved value while a new promise is pending. */ useLastResolvedValue: boolean; }>; /** * Properties from AsyncProp used by {@link renderAsync}. * * @category Internal */ export type RenderAsyncPropInput = Pick, 'value' | 'lastResolvedValue'>; /** * Given a {@link AsyncProp} instance, call and return the output of the `resolutionRender` parameter * once the {@link AsyncProp} has been resolved, call and return the output of the `errorRender` * parameter if the {@link AsyncProp} errored out, return the `fallback` parameter in all other * cases. * * This is the overload for when `resolutionRender` and `errorRender` are both provided. * * @category Async */ export declare function renderAsync(asyncProp: RenderAsyncPropInput, fallback: FallbackResult, resolutionRender: (resolved: Awaited) => ResolutionRenderResult, errorRender: (error: Error) => ErrorRenderResult, options?: RenderAsyncOptions): FallbackResult | ResolutionRenderResult | ErrorRenderResult; /** * Given a {@link AsyncProp} instance, call and return the output of the `resolutionRender` parameter * once the {@link AsyncProp} has been resolved, call and return the output of the `errorRender` * parameter if the {@link AsyncProp} errored out, return the `fallback` parameter in all other * cases. * * This is the overload for when `resolutionRender` is provided but `errorRender` is not. * * @category Async */ export declare function renderAsync(asyncProp: RenderAsyncPropInput, fallback: FallbackResult, resolutionRender: (resolved: Awaited) => ResolutionRenderResult, errorRender?: undefined, options?: RenderAsyncOptions): FallbackResult | ResolutionRenderResult | string; /** * Given a {@link AsyncProp} instance, call and return the output of the `resolutionRender` parameter * once the {@link AsyncProp} has been resolved, call and return the output of the `errorRender` * parameter if the {@link AsyncProp} errored out, return the `fallback` parameter in all other * cases. * * This is the overload for when `resolutionRender` is not provided but `errorRender` is. * * @category Async */ export declare function renderAsync(asyncProp: RenderAsyncPropInput, fallback: FallbackResult, resolutionRender: undefined, errorRender: (error: Error) => ErrorRenderResult, options?: RenderAsyncOptions): FallbackResult | Awaited | ErrorRenderResult; /** * Given a {@link AsyncProp} instance, call and return the output of the `resolutionRender` parameter * once the {@link AsyncProp} has been resolved, call and return the output of the `errorRender` * parameter if the {@link AsyncProp} errored out, return the `fallback` parameter in all other * cases. * * This is the overload for when neither `resolutionRender` or `errorRender` are provided. * * @category Async */ export declare function renderAsync(asyncProp: RenderAsyncPropInput, fallback: FallbackResult, resolutionRender?: undefined, errorRender?: undefined, options?: RenderAsyncOptions): FallbackResult | Awaited | string;