import { ArgumentsType } from "updeep/types/types"; import { AccessorCallPlan } from "../../index.js"; export declare class BailError extends Error { static createdCount: number; /** Gets populated only in some cases (eg. by code in CreateAccessor func) */ callPlanStack: AccessorCallPlan[]; constructor(message: string); /** We create a new error here (rather than extending the existing), since the "original error" can get thrown from multiple parent-accessors, and we need to build up their call-stacks independently. */ WithCallPlanStackExtended(callPlan: AccessorCallPlan): BailError; } declare global { interface Function { /** The function itself, unchanged. */ Normal any)>(this: Func, ..._: ArgumentsType): ReturnType; /** Short for "bail if null". (in commands, generally use .NN instead, as bailing is for "still-loading" situations, which the db-accessors already handle) */ BIN any)>(this: Func, ..._: ArgumentsType): NonNullable>; /** Short for "bail if loading-array", ie. emptyArray_loading. */ BILA any)>(this: Func, ..._: ArgumentsType): NonNullable>; } } export declare class BailContext { onBail_triggerError: boolean; onBail_triggerDebugger: boolean; } export declare function CatchBail(bailResultOrGetter: T, func: (...args: any[]) => ReturnTypeX, args?: any[], thisArg?: any): NonNullable | (T extends (() => any) ? ReturnType : T); export declare let bailContext: BailContext; export declare function Bail(messageOrMessageFunc?: string | Function | null, triggerDebugger?: boolean): never; export declare function BailUnless(condition: any, messageOrMessageFunc?: string | Function | null): asserts condition; export declare const BU: typeof BailUnless; export declare function BailIfNull(val: T, messageOrMessageFunc?: string | Function | null): NonNullable; export declare const BIN: typeof BailIfNull;