Is it possible to get the values of a validated form data?
For example:
const form = useForm({
mode: 'uncontrolled',
initialValues: {
name: data.name ?? '',
age: data.email ?? 0,
countryId: data.countryId ?? null,
},
validate: {
name: isNotEmpty('Name is required'),
age: isInRange({ min: 18 }, 'You must be at least 18 to register'),
countryId: isNotEmpty('Country is required'),
}
});
In this case, type FormValues = typeof form.values; will give out
{
name: string;
age: number;
countryId: string | null;
}
I need countryId to be a string only since validating it with isNotEmpty will prevent having an initial null.