API index and search · Build metadata
Supporting declarations
packages/optimistic/src/index.ts. These declarations explain referenced types. Only package-page symbols are package exports.
MutateFn
/** One entry of the {@link createOptimisticStore} `mutate` facade: call it for a normal optimistic
* write (returns the `mid`), or `.folded(opts, args)` for a debounced, last-value-wins folded write
* (returns a {@link FoldHandle} — the `mid` is assigned at flush, FOLDED-MUTATIONS-DESIGN §3). */
export type MutateFn<Args> = ((args: Args) => number) & {
folded(opts: FoldOptions, args: Args): FoldHandle;
};createOptimisticStore
/** A {@link Store} over an {@link OptimisticBackend}, plus the named-mutator entry
* (`mutate.createIssue(args)` — the §9 dream shape) and the §6 lifecycle surface. */
export declare function createOptimisticStore<S extends ColsMap, R extends ClientRegistry>(schema: Schema<S>, source: OptimisticSource, registry: R, opts: OptimisticBackendOptions): {
store: Store<S>;
backend: OptimisticBackend<S>;
mutate: {
[K in keyof R]: MutateFn<Parameters<R[K]>[1]>;
};
};