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

[In <Contoller />'s render prop] Making param type of onChange method, more strict #11551

Closed
nik32 opened this issue Feb 26, 2024 · 3 comments
Closed
Labels
feature request request a feature to be added waiting-up-vote Waiting for votes from the community.

Comments

@nik32
Copy link

nik32 commented Feb 26, 2024

Is your feature request related to a problem? Please describe.
image
The type of onChange method (as shown in above image) is any[]. But if I have understood correctly... the value passed as param toonChange will be stored with react-hook-form. Like in above case the value passed to onChange would be stored in the timeZone field of the form. But if type of timeZone is string... shouldn't the onChange also accept only a string as a param? With any[] I am allowed to pass any value to the onChange and it gets stored with react-hook-form... and thus bugs occur at the run-time.

Describe the solution you'd like
To infer the type of param (in onChange) based to the type of "name" prop in the <Controller /> (like type of name="timezone" is defined as string... so onChange should also accept only string values)

@nik32 nik32 added feature request request a feature to be added waiting-up-vote Waiting for votes from the community. labels Feb 26, 2024
@bluebill1049
Copy link
Member

yea, we had that. I created a huge problem with all the external UI libraries.

@nik32
Copy link
Author

nik32 commented Feb 26, 2024

Got it! So if it's not appropriate to implement this solution... you can close this issue. Thanks for your prompt response @bluebill1049!

@Moshyfawn
Copy link
Member

Related #10342

@Moshyfawn Moshyfawn closed this as not planned Won't fix, can't repro, duplicate, stale Feb 26, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature request request a feature to be added waiting-up-vote Waiting for votes from the community.
Projects
None yet
Development

No branches or pull requests

3 participants