import type { EventObject, StateValue, MachineContext, ParameterizedObject, AnyMachineSnapshot, NoRequiredParams, WithDynamicParams, Identity, Elements, DoNotInfer } from "./types.js"; type SingleGuardArg = [TGuardArg] extends [{ type: string; }] ? Identity : [TGuardArg] extends [string] ? TGuardArg : GuardPredicate; type NormalizeGuardArg = TGuardArg extends { type: string; } ? Identity & { params: unknown; } : TGuardArg extends string ? { type: TGuardArg; params: undefined; } : '_out_TGuard' extends keyof TGuardArg ? TGuardArg['_out_TGuard'] & ParameterizedObject : never; type NormalizeGuardArgArray = Elements<{ [K in keyof TArg]: NormalizeGuardArg; }>; export type GuardPredicate = { (args: GuardArgs, params: TParams): boolean; _out_TGuard?: TGuard; }; export interface GuardArgs { context: TContext; event: TExpressionEvent; } export type Guard = NoRequiredParams | WithDynamicParams | GuardPredicate; export type UnknownGuard = UnknownReferencedGuard | UnknownInlineGuard; type UnknownReferencedGuard = Guard; type UnknownInlineGuard = Guard; export declare function stateIn(stateValue: StateValue): GuardPredicate; /** * Higher-order guard that evaluates to `true` if the `guard` passed to it evaluates to `false`. * * @category Guards * @example ```ts import { setup, not } from 'xstate'; const machine = setup({ guards: { someNamedGuard: () => false } }).createMachine({ on: { someEvent: { guard: not('someNamedGuard'), actions: () => { // will be executed if guard in `not(...)` // evaluates to `false` } } } }); ``` * @returns A guard */ export declare function not(guard: SingleGuardArg): GuardPredicate>>; /** * Higher-order guard that evaluates to `true` if all `guards` passed to it * evaluate to `true`. * * @category Guards * @example ```ts import { setup, and } from 'xstate'; const machine = setup({ guards: { someNamedGuard: () => true } }).createMachine({ on: { someEvent: { guard: and([ ({ context }) => context.value > 0, 'someNamedGuard' ]), actions: () => { // will be executed if all guards in `and(...)` // evaluate to true } } } }); ``` * @returns A guard action object */ export declare function and(guards: readonly [ ...{ [K in keyof TArg]: SingleGuardArg; } ]): GuardPredicate>>; /** * Higher-order guard that evaluates to `true` if any of the `guards` passed to it * evaluate to `true`. * * @category Guards * @example ```ts import { setup, or } from 'xstate'; const machine = setup({ guards: { someNamedGuard: () => true } }).createMachine({ on: { someEvent: { guard: or([ ({ context }) => context.value > 0, 'someNamedGuard' ]), actions: () => { // will be executed if any of the guards in `or(...)` // evaluate to true } } } }); ``` * @returns A guard action object */ export declare function or(guards: readonly [ ...{ [K in keyof TArg]: SingleGuardArg; } ]): GuardPredicate>>; export declare function evaluateGuard(guard: UnknownGuard | UnknownInlineGuard, context: TContext, event: TExpressionEvent, snapshot: AnyMachineSnapshot): boolean; export {};