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

Add a classify function for onChange argument #16

Merged
merged 1 commit into from
Aug 17, 2021

Conversation

gaku-sei
Copy link
Contributor

Normally this logic is done by react-hook-form in the onChange callback, but it's useful to be able to look at what the onChange argument is when you implement your own logic.

unknown->Js.Nullable.return->Js.Nullable.isNullable->not &&
Obj.magic(unknown)["_reactName"] == "onChange"
? Event(Obj.magic(unknown))
: Value(Obj.magic(unknown))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to confirm this one is just for checking what kind of type of Argument that passed via the onClick function in rescript-hook-form right @gaku-sei .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. To be honest it's not perfect and you can "fool" it, but it's rather unlikely to happen 😕

Copy link
Contributor

@infothien infothien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gaku-sei gaku-sei merged commit c97fb3a into main Aug 17, 2021
@gaku-sei gaku-sei deleted the classify-opaque-types branch August 17, 2021 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants