final-form / final-form/react-final-form-arrays

Should the type of FieldArrayRenderProps['fields']['length'] be non-optional?

Open
#26 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
210
Forks
69
PR merge metrics
No merged PRs in 30d

Description

Currently `FieldArrayRenderProps.fields` gets `length` from `FieldState` where it is optional: `length?: number`. From the code, it looks like it is expected to always be a `number`. With it being optional you end up needing to do things like `fields.length && fields.length > 1` if you want to see if there's more than one field. If you agree, I'd be happy to submit a PR

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.