AFAIK you can’t use annotations inside props or types, you have to use the Nullable.t type here, but there’s a more idiomatic way to handle them starting from v11:
let onChange = (selected: Nullable.t<ComboBox.opt>) =>
setSelected(_ =>
switch selected {
| Null | Undefined => ""
| Value({value}) => value
}
)
PS. In theory, if you don’t want to handle the null or undefined case everywhere, the easiest solution would be to define two bindings, one where nullable is false and the other one where it’s set to true and change the types of other props accordingly, but for some reason, defining fixed default don’t seem to work with JSX v4 right now, it might get fixed in the future.