InitialState
InitialState<
Context,Protocol>(TargetState):void
Declares TargetState as the initial substate of its direct parent composite.
Apply as a TypeScript decorator or call as a function at class definition time. Exactly one initial child is allowed per parent; a second mark throws InitialStateError.
Type Parameters
Context
Context
Domain context type
Protocol
Protocol extends { } | undefined
Vocabulary interface
Parameters
TargetState
StateClass<Context, Protocol>
Child state class whose parent is Object.getPrototypeOf(TargetState.prototype).constructor
Returns
void
Throws
InitialStateError when the parent already has an initial substate
Remarks
During makeHsm initialization, the runtime descends @InitialState chains from the
root until the deepest initial leaf is active, running StateEvents.onEntry along the path.
Example
class Composite extends TopState {}
@InitialState
class Idle extends Composite {}