While typing I was confused why and in what cases the event would be undefined. Only when I was rewriting I realized that the initial event is undefined, which is not that explicit at it's intent.
Libraries often have their initial event, like xstate has "xstate.init", redux has "@@INIT" afaik, storeon also has "@init". It's better to have event: { type: "FOO" } | { type: $$initial } rather than have event?: { type: "FOO" }. So I'd suggest there should be an explicit initial event, perhaps a symbol would be good.
While typing I was confused why and in what cases the event would be undefined. Only when I was rewriting I realized that the initial event is undefined, which is not that explicit at it's intent.
Libraries often have their initial event, like xstate has
"xstate.init"
, redux has"@@INIT"
afaik, storeon also has"@init"
. It's better to haveevent: { type: "FOO" } | { type: $$initial }
rather than haveevent?: { type: "FOO" }
. So I'd suggest there should be an explicit initial event, perhaps a symbol would be good.