Since value is string | undefined, I think that undefined should be the value when the menu of a Dropdown is reset, not an empty string. It makes no sense to me that "" indicates no value when the types clearly state that the value can be undefined. It's a way to get a bug without noticing it - someone might not expect an empty string to be passed to select, thinking that undefined is the value when nothing is selected. A user's code might then assume that a proper option with value set to "" was selected and throw an unexpected error because of that instead of discarding it as a non-value if it was undefined.
Since
value
isstring | undefined
, I think that undefined should be the value when the menu of aDropdown
is reset, not an empty string. It makes no sense to me that""
indicates no value when the types clearly state that thevalue
can beundefined
. It's a way to get a bug without noticing it - someone might not expect an empty string to be passed toselect
, thinking thatundefined
is the value when nothing is selected. A user's code might then assume that a proper option withvalue
set to""
was selected and throw an unexpected error because of that instead of discarding it as a non-value if it wasundefined
.