-
Hi there! I'm new to xstate, quick question about keeping Typescript happy: Suppose I have two events {
events: {} as | TypeA | Type B
} Then for any action I define in the same Then, the action handlers will complain if you make presumptions about the type of the action, even though you're only linking one action to one event. Unless you do a matching for help typescript eliminate other possibilities, like this: So my questions are:
I have no problem with doing matches, just curious if there are better ways.
By that I mean, if I do not return But that means, every action handler will have at least three lines when you have more than one |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Actually, I just realized these are covered here: https://stately.ai/docs/typescript So if this is no further comments, I'll close this tomorrow. |
Beta Was this translation helpful? Give feedback.
Actually, I just realized these are covered here: https://stately.ai/docs/typescript
So if this is no further comments, I'll close this tomorrow.