import { ChangeEvent, FocusEvent } from 'react'; import { IApiDto, JSONObject, JSONValue, Target } from '../api/ApiDto'; export type HandleChangeType = { (e: ChangeEvent): void; >(field: T): T extends ChangeEvent ? void : (e: string | ChangeEvent) => void; }; export type HandleBlurType = { (e: FocusEvent): void; (fieldOrEvent: T): T extends string ? (e: Target) => void : void; }; export type SetFieldValueType = (field: string, value: JSONObject, shouldValidate?: boolean | undefined) => Promise; export type ValidateFormType = (values?: JSONObject) => Promise; export interface IFormPropsDto { values?: JSONObject; errors?: JSONObject; touched?: JSONObject; validationSchema?: JSONObject; handleChange?: HandleChangeType; handleBlur?: HandleBlurType; handleSubmit?: (values: IApiDto) => void; validateForm?: ValidateFormType; setFieldValue?: SetFieldValueType; errorMessage?: string; } export interface IOrderDto extends IApiDto { libelle: string; orderAsc?: boolean; }