NGXS - 从父状态访问子状态

NGXS - accessing child state from parent state

我有亲子状态:

@State({
     name: 'parent',
     default: { parentProp : 'foo' },
     children: [
        ChildState,
     ]
}) class ParentState {}

@State({
     name: 'child',
     default: { childProp: 'bar' },
}) class ChildState {}

然后在父状态的一个动作中,我想从子状态中获取状态。 有没有办法在动作处理程序中做到这一点,目前我不知道该怎么做,因为动作处理程序只有 StateContext 和动作有效负载?

看来我可以做类似

的事情
const child = <ChildStateModel>this.store.selectSnapshot(state => state.child);

或者直接使用

@Action(context: StateContext<ChildStateModel>, action: any)

如果只需要访问child