Closed stefnotch closed 5 years ago
I think the default of true here is probably more desired given your example. Another option may be to require an explicit return of boolean from the callback to warn users at compile time, which avoid the change in default behavior but gives the developer warning.
onEnter
expects a boolean return value. If it'sfalse
, TypeState does not enter the state. If it'strue
TypeState enters the state.However, if it's
undefined
, which happens if the user simply didn't return anything, TypeState will interpret it asfalse
and thus, not enter the state. This is usually not what the user intended to happen.Example:
My suggestion would be to default to
true
if the return value isundefined
. However, in some cases this could also result in undesired behaviour.