vee-validate
                                
                                 vee-validate copied to clipboard
                                
                                    vee-validate copied to clipboard
                            
                            
                            
                        [v4] FormErrors should allow pass value type or has any | undefined value type.
Yup exemple from docs using-a-custom-locale-dictionary:
setLocale({
  // use constant translation keys for messages without values
  mixed: {
    default: 'field_invalid',
  },
  // use functions to generate an error object that includes the value from the schema
  number: {
    min: ({ min }): YupValue => ({ key: 'field_too_short', values: { min } }),
    max: ({ max }): YupValue => ({ key: 'field_too_big', values: { max } }),
  },
});
Expected Type:
// my-port-yop, this can be typed much better
type YupValue = { key: TValues[keyof TValues], values: any };
// vee-validate
declare type FormErrors<TValues extends Record<string, unknown>> = Partial<Record<
  keyof TValues, 
  YupValue
>>;
Current Type:
// vee-validate
declare type FormErrors<TValues extends Record<string, unknown>> = Partial<Record<
  keyof TValues, 
  string | undefined
>>;
Exemple:
    useForm({
      validationSchema: markRaw(
      io.object({
        password: io.string().required().min(2),
      })
    ),
    }).errors.password // string | undefined, but real type is { key: 'field_too_short', values: { min } }
Why i use object as result?
- For custom t(password.key, password.values)in view.
- For t(password.key, { ...password.values, path: t(password.values.path) })when path translation defined in component.
Interesting use case, I think it's a good addition and would try to add it for the next patch. Thanks for bringing this up.