Implicit type conversion?
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- react
- Domain
- frontend
Research direction
Start with the ReactEvent.Form.target(evt)["value"] expression and the useState setter in the supplied component, then reproduce the behavior using the linked Playground. Compare the result with the linked forum thread and determine whether the inferred type is intentional; done means the behavior is clarified or a concrete repository change is identified.
Written by the indexing model from the issue text.
Description
Hello,
I’m exploring rescript-react and noticed a peculiar behaviour. Here’s my test code:
module MyComponent = {
@react.component
let make = () => {
let (value, setValue) = React.useState(_ => 0)
<>
<div> {React.string(string_of_int(value))} </div>
<input
onChange={evt => {
let x = ReactEvent.Form.target(evt)["value"] // 1
setValue(_ => x) // 2
}}
/>
</>
}
}
What I noticed is that on the line marked with // 1 the type of x is 'a, but on line // 2 hovering over x shows the type int. Why is that? I would expect the compiler to ask me to decode the value of x.
Thank you in advance!
P.S.
- Dominant language
- ReScript
- Stars
- 517
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rescript-lang/rescript-react
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
rescript-lang/rescript-react#145 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
rescript-lang/rescript-react#152 · 3 reactions ·
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
rescript-lang/rescript-react#147 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
rescript-lang/rescript-react#111 · 3 comments ·
-
Scroll Restoration Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
rescript-lang/rescript-react#104 · 1 reaction ·
All issues in rescript-lang/rescript-react
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
lobehub/lobe-icons#422 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
www.guideflow.com OpenN: AdGuard Browser Extension P4: Low T: Social Widget
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AdguardTeam/AdguardFilters#242250 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100