Minor Changes
-
6596d0ba
#1622 Thanks @davidkpiano! - Spawned/invoked actors and interpreters are now typed as extendingActorRef
(e.g.,SpawnedActorRef
) rather thanActor
orInterpreter
. This unification of types should make it more straightforward to provide actor types:import { - Actor + ActorRef } from 'xstate'; // ... interface SomeContext { - server?: Actor; + server?: ActorRef<ServerEvent>; }
It's also easier to specify the type of a spawned/invoked machine with
ActorRefFrom
:import { createMachine, - Actor + ActorRefFrom } from 'xstate'; const serverMachine = createMachine<ServerContext, ServerEvent>({ // ... }); interface SomeContext { - server?: Actor; // difficult to type + server?: ActorRefFrom<typeof serverMachine>; }