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
There are type errors when attempting to use a string as the name of a state in the onDone or onError portion for an invoked service, even though this should be considered a perfectly valid configuration, and without typescript functions just fine.
Expected result
The following simple machine should not cause type errors:
Type '{ src: () => () => void; onDone: (string | { target: string; })[]; }' is not assignable to type 'SingleOrArray<AnyStateMachine | InvokeConfig<unknown, AnyEventObject>>'.
Types of property 'onDone' are incompatible.
Type '(string | { target: string; })[]' is not assignable to type 'string | SingleOrArray<TransitionConfig<unknown, DoneInvokeEvent<any>>>'.
Type '(string | { target: string; })[]' is not assignable to type 'TransitionConfig<unknown, DoneInvokeEvent<any>>[]'.
Type 'string | { target: string; }' is not assignable to type 'TransitionConfig<unknown, DoneInvokeEvent<any>>'.
Type 'string' has no properties in common with type 'TransitionConfig<unknown, DoneInvokeEvent<any>>'.ts(2322)
Description
There are type errors when attempting to use a string as the name of a state in the
onDone
oronError
portion for an invoked service, even though this should be considered a perfectly valid configuration, and without typescript functions just fine.Expected result
The following simple machine should not cause type errors:
Actual result
Typescript is unhappy:
Reproduction
https://codesandbox.io/s/currying-shadow-8tnshi?file=/src/index.ts
Additional context
Originally reported here: statelyai/xstate-tools#275
The text was updated successfully, but these errors were encountered: