UNPKG

syncbasestore

Version:

Lightweight reactive store with built-in filtering and async state handling

15 lines (14 loc) 702 B
import { Status, FieldState, Validator } from '../store/types'; type FieldValue<T> = T extends FieldState<infer V> ? V : never; export declare function useBuildBase<Root extends Record<TileKey, Record<string, FieldState<any>>>, TileKey extends keyof Root>(tileKey: TileKey, validators: { [P in keyof Root[TileKey]]?: Validator<FieldValue<Root[TileKey][P]>>; }, options?: { clearOnUnmount?: boolean; initialState?: Root[TileKey]; }): { setField: <Field extends keyof Root[TileKey] & string>(field: Field, rawValue: FieldValue<Root[TileKey][Field]>) => void; fields: Record<string, FieldState<any>>; overallStatus: Status; invalidFields: Record<string, string>; }; export {};