-
Notifications
You must be signed in to change notification settings - Fork 463
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
Bug: Not possible to use default value for renamed props in JSX 4 #6375
Comments
Good catch! module C3 = {
type props<'disabled> = {disabled?: 'disabled}
let make = ({disabled: ?everythingDisabled, _}: props<bool>) => {
let disabled = switch disabled { // should use everythingDisabled
| Some(disabled) => disabled
| None => false
}
{
React.string(everythingDisabled ? "true" : "false")
}
}
...
}
|
This seems fine to me. I think this could be fixed at the same time with issue #6374. module C3 = {
type props<'disabled> = {disabled?: 'disabled}
let make = ({disabled: ?everythingDisabled_, _}: props<bool>) => { // rename alias *_
let everythingDisabled = switch everythingDisabled_ { // refer to it here
| Some(everythingDisabled) => everythingDisabled
| None => false
}
{
React.string(everythingDisabled ? "true" : "false")
}
}
...
} |
module C3 = {
type props<'disabled> = {disabled?: 'disabled}
let make = (props: props<bool>) => {
let everythingDisabled = switch props {
| {disabled} => disabled
| _ => false
}
{
React.string(everythingDisabled ? "true" : "false")
}
}
...
}
|
Ah, I'm afraid of the case when we have other props along with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://rescript-lang.org/try?version=v10.1.2&code=ALBWGcA8GEHsDsBmBLA5gCgN4DcCmAncZBALgAIBmAXwEoAoOgW1gBMBXAG1zIEkAXXIzIBeMpjpkywfLgCGAYz4A6ebEYAHBLnh8JZLnzKNZAa26j0APxbJwsgEZcWZWeDK48+AJ58AFsnhUABFbBydye1hYDmFEWQ5wXBoRAD4xPUkAJTlFJXA+fACMDwIff0CQu0dcZwB+MgAiArZcBrJyBriE1vpJKjp+uhAIGAQUDBwCIlIyABZaBmZ2Ll4BRgAmEXTJaRzlVQ0tHT0DI1NzMisbKqcXNxLvPyLKsJqIqJiuxOThNPFJLJ7PIFIroB5lZ6hap1RrNVrtRpfHp6fr9IA
The text was updated successfully, but these errors were encountered: