Closed
Description
Are you submitting a bug report or a feature request?
bug report
What is the current behavior?
It's just error on typescripts.
Type '(value: UserValue[]) => ValidationErrors[]' is not assignable to type 'FieldValidator<UserValue>'.
Types of parameters 'value' and 'value' are incompatible.
Type 'UserValue' is missing the following properties from type 'UserValue[]': length, pop, push, concat, and 28 more. TS2322
221 | ...
222 | />
> 223 | <FieldArray<UserValue> name="users" validate={this.validateUser}>
| ^
224 | {({ fields }) => (
225 | ...
and my validation is
validateUser = (value: UserValue[]) => {
...
};
What is the expected behavior?
I think on definition UseFieldArrayConfig
interface here, it should be assigned validate method as validate?: FieldValidator<FieldValue[]>
.Otherwise it's defined with FieldValidator<FieldValue>
and it occurs above type mismatch.
What's your environment?
% grep final-form ./package.json
./package.json:10: "final-form": "^4.16.1",
./package.json:11: "final-form-arrays": "^1.1.2",
./package.json:21: "react-final-form": "^6.3.0",
./package.json:22: "react-final-form-arrays": "^3.1.0",
Other information
If this change is ok, I can create PR for this.
Metadata
Metadata
Assignees
Labels
No labels
Activity
erikras commentedon Jul 12, 2019
Or maybe...
extends UseFieldConfig<FieldValue>
➡️extends UseFieldConfig<FieldValue[]>
?
cinemaster commentedon Jul 15, 2019
Ah, yes.
It's much better, I think.
MaciejSzewczyszyn commentedon Aug 20, 2019
Hi, any progress on this?
evgenii-bond commentedon Sep 30, 2019
any progress on this?
erikras commentedon Jul 23, 2020
Published fix in
v3.1.2
.