UNPKG

rehance-forms

Version:
37 lines (36 loc) 971 B
import { EventBus } from "./EventBus"; export declare type Diff<T extends string | number | symbol, U extends string | number | symbol> = ({ [P in T]: P; } & { [P in U]: never; } & { [x: string]: never; })[T]; export declare type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>; export declare type FieldMap = { [field: string]: any; }; export declare type StringMap = { [field: string]: string; }; export declare type BoolMap = { [field: string]: boolean; }; export declare type ErrorMap = { [key: string]: ContextError; }; export declare type ContextError = null | string | ErrorMap | ErrorMap[]; export interface IScopeChild { value: any; valid: boolean; changed: boolean; reset(): void; clear(): void; commit(): void; } export interface IScopeContext extends IScopeChild { readonly root: IScopeContext; readonly parent: IScopeContext | null; readonly events: EventBus; readonly id: string; }