We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
validateFields
When I try to compile a Field using validateFields={[]} the TypeScript compiler gives me an error:
validateFields={[]}
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:
index.d.ts
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
The text was updated successfully, but these errors were encountered:
Confirm this. Just was about to report the same...
Sorry, something went wrong.
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:
validate
final-form
meta
https://github.com/final-form/final-form/blob/master/src/types.js.flow#L111
Any idea why it can happen?
Solved in recent versions
No branches or pull requests
bug report
Missing
validateFields
in type definition for FieldPropsWhen I try to compile a Field using
validateFields={[]}
the TypeScript compiler gives me an error:My sample code is:
I changed the FieldProps definition in
index.d.ts
and the error went away:Can you confirm? I can submit a PR with the change if ok with you.
Thank you
Michele
The text was updated successfully, but these errors were encountered: