react-final-form-arrays
react-final-form-arrays copied to clipboard
Incorrect typings for FieldArray.initialValues
Are you submitting a bug report or a feature request?
Bug report
What is the current behavior?
I got an error when pass initialValues as an array
interface MyType {
name: string;
}
...
<FieldArray<MyType> name="test" initialValue={[{name: ''}]}>
</FieldArray>
Error: Type: MyType[] has no properties in common with type MyType;
What is the expected behavior?
Compiling without errors
Sandbox Link
What's your environment?
"final-form": "^4.18.2",
"final-form-arrays": "^1.1.2",
"react-final-form": "^6.3.0",
"react-final-form-arrays": "^3.1.1",
Other information
I assume it can be solved by changing
export interface UseFieldArrayConfig<FieldValue>
extends UseFieldConfig<FieldValue> {
isEqual?: (a: any[], b: any[]) => boolean
}
to
export interface UseFieldArrayConfig<FieldValue>
extends UseFieldConfig<FieldValue[]> {
isEqual?: (a: any[], b: any[]) => boolean
}
~@erikras hello! This problem still exists. If you don't mind I would fix it and open PR.~
My fault. It was fixed in v3.1.2, sorry for mention.