syncbasestore
Version:
Lightweight reactive store with built-in filtering and async state handling
25 lines (24 loc) • 688 B
TypeScript
import { SyncBaseStore } from '../store/SyncBaseStore';
type FieldStatus = {
value: any;
status: 'idle' | 'isError' | 'isSuccess' | 'isWarning';
message?: string;
};
type FormState<T> = {
[K in keyof T]: FieldStatus;
};
export declare function claimBase<T>(store: SyncBaseStore<FormState<T>>): {
getField: <K extends keyof T>(key: K) => FormState<T>[K];
full: FormState<T>;
validatedFields: Partial<Record<keyof T, any>>;
invalidFields: Partial<Record<keyof T, {
message?: string;
value: any;
}>>;
warningFields: Partial<Record<keyof T, {
message?: string;
value: any;
}>>;
formStatus: string;
};
export {};