Skip to content
New issue

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

FieldInputProps interface incorrectly extends AnyObject #991

Open
jsonunger opened this issue May 9, 2022 · 0 comments
Open

FieldInputProps interface incorrectly extends AnyObject #991

jsonunger opened this issue May 9, 2022 · 0 comments

Comments

@jsonunger
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant