FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: strict types for form events by ivan-demchenko · Pull Request #106 · rescript-lang/rescript-react · GitHub

feat: strict types for form events - #106

Open
ivan-demchenko wants to merge 1 commit into
rescript-lang:masterfrom
ivan-demchenko:feat/stricter-types-for-form-events
Open

feat: strict types for form events#106
ivan-demchenko wants to merge 1 commit into
rescript-lang:masterfrom
ivan-demchenko:feat/stricter-types-for-form-events

Conversation

Copy link
Copy Markdown

This PR makes use of Js.Json.t instead of object type for form events. It addresses this issue:
#105

Context:

let targetValueToInt = (target: Js.Json.t): int => {
 // Js.Json.decodeObject(target)) 
 // and so on
}
// ...
<input
  onChange={
    evt => {
      setIntValue(_prev => evt->ReactEvent.Form.target->targetValueToInt);
    }
  }
/>

mununki commented Jan 8, 2024

Copy link
Copy Markdown
Member

Thank you for PR!
The big difference between object and JSON is that undefined doesn't exist in JSON's specification. I'm not sure why we need to type-define form event as JSON format instead of object, can you explain further?

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL