import { type NoInputsFunction } from '@augment-vir/core'; import { type RequireOneOrNone } from 'type-fest'; /** * Options for {@link wrapInTry}. * * @category Function * @category Package : @augment-vir/common * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common) */ export type WrapInTryOptions = RequireOneOrNone<{ /** * Call this function if the callback passed to {@link wrapInTry} throws an error. The thrown * error is passed to this function. If a `fallbackValue` option is also provided, it will be * ignored. */ handleError: (error: unknown) => FallbackValue; /** * Fallback to this value if the callback passed to {@link wrapInTry} throws an error. This will * be ignored if a `handleError` option is also set. */ fallbackValue: FallbackValue; }>; export declare function wrapInTry>(callback: NoInputsFunction, options?: undefined | { handleError?: never; fallbackValue?: never; }): Promise>; export declare function wrapInTry(callback: NoInputsFunction, options?: undefined | { handleError?: never; fallbackValue?: never; }): Error | Value; export declare function wrapInTry, FallbackValue = undefined>(callback: NoInputsFunction, options: { handleError: (error: unknown) => FallbackValue; fallbackValue?: never; }): Promise | Awaited>; export declare function wrapInTry(callback: NoInputsFunction, options: { handleError: (error: unknown) => FallbackValue; fallbackValue?: never; }): FallbackValue | Value; export declare function wrapInTry, FallbackValue = undefined>(callback: NoInputsFunction, options: { handleError?: never; fallbackValue: FallbackValue; }): Promise | Awaited>; export declare function wrapInTry(callback: NoInputsFunction, options: { handleError?: never; fallbackValue: FallbackValue; }): FallbackValue | Value; export declare function wrapInTry, FallbackValue = undefined>(callback: NoInputsFunction, options?: WrapInTryOptions | undefined): Promise; export declare function wrapInTry(callback: NoInputsFunction, options?: WrapInTryOptions | undefined): FallbackValue | Value | Error;