validateFields is missing in the type definition of FieldProps
bug report
Missing validateFields in type definition for FieldProps
When I try to compile a Field using validateFields={[]} the TypeScript compiler gives me an error:
error TS2339: Property 'validateFields' does not exist on type 'IntrinsicAttributes & { allowNull?: boolean | undefined; format?: ((value: any, name: string) => ...'.
My sample code is:
<Field name="last_name" validate={this.validateRequired} validateFields={[]}>
{( { meta, input } ) => (
<input
type="text"
className={(!meta.pristine || meta.touched ? meta.error || 'Valid' : '' ) as string}
{...input}
/>)}
</Field>
I changed the FieldProps definition in index.d.ts and the error went away:
export type FieldProps = {
allowNull?: boolean
format?: ((value: any, name: string) => any) | null
parse?: ((value: any, name: string) => any) | null
name: string
subscription?: FieldSubscription
validate?: (value: any, allValues: object) => any
value?: any
validateFields?: string[]
} & RenderableProps<FieldRenderProps>
Can you confirm? I can submit a PR with the change if ok with you.
Thank you Michele
Confirm this. Just was about to report the same...

I just had a look at it and it's actually kinda weird.
https://github.com/final-form/react-final-form/blob/master/src/types.js.flow#L89
It takes a definition of validate method from final-form package. The strange thing here is that final-form has meta inside:
https://github.com/final-form/final-form/blob/master/src/types.js.flow#L111
Any idea why it can happen?
Solved in recent versions