How to correctly type errorMap?
export type ValidationSchemaType = typeof validationSchema;
export type FormFields = keyof z.infer<ValidationSchemaType>;
export type ReceiptFormType = ReturnType<
typeof useForm<
z.infer<ValidationSchemaType>,
any,
any,
any,
any,
any,
any,
any,
any,
any
>
>;And the following component:
<receiptForm.Subscribe
selector={(state) => [
state.canSubmit,
state.isSubmitting,
state.isTouched,
state.fieldMeta,
state.errorMap,
]}
children={([canSubmit, isSubmitting, isTouched, fieldMeta, errorMap]) => {
// ...
}}
/>In this component,
receiptForm is typed as ReceiptFormType.How can I make
errorMap inside the children render prop be correctly typed, so that the types of its fields like onSubmit, onChange, etc. are recognized properly?