///
export type FormState = {
[K in keyof T]: T[K];
};
export type ValidValueType = string | number | boolean | File | null;
export type ResolverSuccess = {
data: T;
errors: null;
};
export type ResolverError = {
data: null;
errors: string;
};
export type Resolver = ResolverSuccess | ResolverError;
export type FormResolver = (data: FormState) => Promise>;
export type FormSubmitHandler = (data: FormState) => Promise | void;
export type ValidatorFn = (value: ValidValueType) => boolean;
export type FormValidation = {
[key: string]: [ValidatorFn, string];
};
export type FormValidationState = {
[key: string]: string | null;
};
export interface ChangeEvent {
target: {
name: string;
value: any;
type?: string;
checked?: boolean;
files?: FileList;
};
}
export interface FocusEvent {
target: {
name: string;
};
}
export interface MyChangeEvent extends React.ChangeEvent {
}
export interface MyFocusEvent extends React.FocusEvent {
}