import { EventObject, EventPayloadMap, StoreContext, StoreExtension } from "./types.js"; interface ResetOptions { /** * Custom reset function. Receives the initial context and the current * context, returns the context to reset to. * * Defaults to returning the initial context (full reset). */ to?: (initialContext: TContext, currentContext: TContext) => TContext; } /** * Creates a store extension that adds a `reset` trigger to reset the store * context to its initial state. * * @example * * ```ts * import { reset } from '@xstate/store/reset'; * * const store = createStore({ * context: { count: 0 }, * on: { inc: (ctx) => ({ count: ctx.count + 1 }) } * }).with(reset()); * * store.trigger.inc(); * store.trigger.reset(); // count = 0 * ``` * * @example * * ```ts * // Partial reset: keep some fields * const store = createStore({ * context: { count: 0, user: null as string | null }, * on: { * inc: (ctx) => ({ ...ctx, count: ctx.count + 1 }), * login: (ctx, e: { user: string }) => ({ ...ctx, user: e.user }) * } * }).with( * reset({ * to: (initial, current) => ({ ...initial, user: current.user }) * }) * ); * * store.trigger.reset(); // resets count, keeps user * ``` */ export declare function reset(options?: ResetOptions): StoreExtension; export {};