statelyai / xstate

Actor-based state management & orchestration for complex app logic.
https://stately.ai/docs
MIT License
26.98k stars 1.24k forks source link

Bug: Spawn and TS error #4847

Closed lambda0xff closed 5 months ago

lambda0xff commented 5 months ago

XState version

XState version 5

Description

When spawning a child machine, I get a TS error. entry: assign({ theChild: ({ spawn }) => spawn(child) }) // squigly error line under child

Expected result

There should not be a TS error

Actual result

The child machine is correctly spawned but I get this TS error: Argument of type 'StateMachine<MachineContext, AnyEventObject, Record<string, AnyActorRef>, ProvidedActor, ParameterizedObject, ... 7 more ..., ResolveTypegenMeta<...>>' is not assignable to parameter of type 'never'.(2345)

Reproduction

https://stackblitz.com/edit/github-eldaka?file=src%2FfeedbackMachine.ts

Additional context

No response

lambda0xff commented 5 months ago

Probably duplicate of #4814