-
Notifications
You must be signed in to change notification settings - Fork 469
Closed as not planned
Closed as not planned
Copy link
Labels
staleOld issues that went staleOld issues that went stale
Description
Here's an example on different confusing errors / warnings:
type props = {count: int, username?: string}
let make = props => {
// This is a pattern match, so it warns me with
// "You forgot to handle a possible case here, for example: {count: _, username: None, _}"
// As a user I would have expected `username` just to be a `option<string>` and that's it
let {count, username} = props
// This typechecks, even though this shouldn't.
// `username` should be an option<string>
Js.String2.toLowerCase(username)->ignore
// This pattern match warns me on missing case, since it thinks it's matching on `props`, not
// on `props.username`:
// "You forgot to handle a possible case here, for example: {count: _, username: None, _}"
let _ = switch props.username {
| Some("test") => "test"
| _ => "whatever"
}
<div />
}
I think it all boils down to the fact that the initial props destructing doesn't really do what I actually expected.
Is this expected behavior?
Metadata
Metadata
Assignees
Labels
staleOld issues that went staleOld issues that went stale