react-final-form icon indicating copy to clipboard operation
react-final-form copied to clipboard

FieldInputProps interface incorrectly extends AnyObject

Open jsonunger opened this issue 3 years ago • 0 comments

Are you submitting a bug report or a feature request?

What is the current behavior?

FieldInputProps extends AnyObject, creating the assumption that input can include any field beyond the defined values.

What is the expected behavior?

FieldInputProps doesn't extend AnyObject since it's explicit in its declaration what it includes.

Sandbox Link

What's your environment?

React Final Form v6.5.9 Final Form v4.20.7 TypeScript v4.6.2

Other information

The FieldInputProps interface extends an AnyObject interface that is just an index signature. As a result, the code assumes that the input object that exists in the field render props can include any number of fields beyond what is explicitly defined. However, the useField hook that is exported directly and used in the Field component internally explicitly defines the input object with the keys matching the FieldInputProps interface. Given that, there is no reason to have FieldInputProps extend this index signature.

jsonunger avatar May 09 '22 15:05 jsonunger