import { R as Result } from "../packem_shared/types.d-C7l7qdMG.js"; /** * A successful {@link Result} with its data narrowed to be present. */ type OkResult = Result & { data: T; success: true; }; /** * A failed {@link Result}, narrowed to the failure case. */ type FailResult = Result & { success: false; }; /** * Returns whether a {@link Result} succeeded, narrowing `data` to be present. * @param result The result to test. * @returns `true` when the result is successful. */ declare const isOk: (result: Result) => result is OkResult; /** * Returns whether a {@link Result} failed. * @param result The result to test. * @returns `true` when the result is a failure. */ declare const isErr: (result: Result) => result is FailResult; /** * Returns the data of a successful {@link Result}, or throws its error. * @param result The result to unwrap. * @returns The contained data. * @throws {NotificationError} The result's error (wrapped when it is not already an `Error`). */ declare const unwrap: (result: Result) => T; /** * Returns the data of a successful {@link Result}, or a fallback when it failed. * @param result The result to unwrap. * @param fallback The value to return on failure. * @returns The data, or the fallback. */ declare const unwrapOr: (result: Result, fallback: T) => T; /** * Maps the data of a successful {@link Result}, passing failures through unchanged. * @param result The result to map. * @param function_ The mapper applied to the data on success. * @returns A new result with the mapped data, or the original failure. */ declare const mapOk: (result: Result, function_: (data: T) => U) => Result; /** * Runs an async function and captures its outcome as a {@link Result}, never throwing. * @param function_ The async function to run. * @returns A successful result with the value, or a failed result with the thrown error. */ declare const tryAsync: (function_: () => Promise) => Promise>; export { FailResult, OkResult, isErr, isOk, mapOk, tryAsync, unwrap, unwrapOr };