You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the code below, thing is allowed in the RUN transition. If you remove the actions: 'doAction' then it will properly catch the error and not allow thing. This seems to be specific to assign.
In my real world code, I accidentally had type: instead of target: and it took a bit to figure out why my machine wasn't working as expected.
This has nothing to do with assign. With setup API our whole config is the target of inference - inferred type arguments are exempt from excess property check (which is something between a lint rule and a hard error in TS). We can't do anything about it right now - this is how TS works.
With Type '{ thing: string; }' is not assignable to type 'TransitionConfigOrTarget<Context, Events, Events, never, { type: "doAction"; params: NonReducibleUnknown; }, never, never, EventObject>'.
XState version
XState version 5
Description
In the code below,
thing
is allowed in theRUN
transition. If you remove theactions: 'doAction'
then it will properly catch the error and not allowthing
. This seems to be specific toassign
.In my real world code, I accidentally had
type:
instead oftarget:
and it took a bit to figure out why my machine wasn't working as expected.Expected result
thing
is not assignable to type 'TransitionConfigOrTarget`Actual result
It type checks
Reproduction
https://stackblitz.com/edit/vitejs-vite-9vip7x?file=src%2Fmachine.ts,tsconfig.json&terminal=dev
Additional context
No response
The text was updated successfully, but these errors were encountered: