xstate-tools
xstate-tools copied to clipboard
Typegen: Ensure that state.matches allows for object-based checks on states with no children
I.e. in this machine:
const machine = createMachine({
initial: 'a',
states: { a: {} },
})
You should be able to run:
state.matches({ a: {} })
Is this desired though? It somewhat looks incomplete and/or implies that some child states can be added to it.
Yes, because you want to be able to make parallel-based checks, like so:
https://discord.com/channels/795785288994652170/962341003266760786/962343455135264828

Yuck 😬 I don't have a better idea though - so ye, we should support this then
Agree; this should be supported