Lifecycle & Config
Helper Types
Rivet provides several TypeScript helper types to make it easier to work with actors in a type-safe way.
Context
Types
When working with actors, you often need to access the context object outside of the actor's handlers. Rivet provides helper types to extract the context types from actor definitions.
ActorContextOf<ActorDefinition>
Extracts the full actor context type from an actor definition. This is the type of the context object (c
) available in lifecycle hooks and in actions.
TypeScript
ActionContextOf<ActorDefinition>
Extracts the action context type from an actor definition. This is the type of the context object (c
) available in actions. This cannot be used in lifecycle hooks.
TypeScript