xstate 4.34.0 → 4.35.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/types.d.ts CHANGED
@@ -610,7 +610,6 @@ export interface ActivityMap {
610
610
  export interface StateTransition<TContext, TEvent extends EventObject> {
611
611
  transitions: Array<TransitionDefinition<TContext, TEvent>>;
612
612
  configuration: Array<StateNode<TContext, any, TEvent, any, any, any>>;
613
- entrySet: Array<StateNode<TContext, any, TEvent, any, any, any>>;
614
613
  exitSet: Array<StateNode<TContext, any, TEvent, any, any, any>>;
615
614
  /**
616
615
  * The source state that preceded the transition.
@@ -754,7 +753,7 @@ export interface AssignAction<TContext, TEvent extends EventObject> extends Acti
754
753
  }
755
754
  export interface PureAction<TContext, TEvent extends EventObject> extends ActionObject<TContext, TEvent> {
756
755
  type: ActionTypes.Pure;
757
- get: (context: TContext, event: TEvent) => SingleOrArray<ActionObject<TContext, TEvent>> | undefined;
756
+ get: (context: TContext, event: TEvent) => SingleOrArray<ActionObject<TContext, TEvent> | ActionObject<TContext, TEvent>['type']> | undefined;
758
757
  }
759
758
  export interface ChooseAction<TContext, TEvent extends EventObject> extends ActionObject<TContext, TEvent> {
760
759
  type: ActionTypes.Choose;
package/es/waitFor.d.ts CHANGED
@@ -11,6 +11,8 @@ interface WaitForOptions {
11
11
  /**
12
12
  * Subscribes to an actor ref and waits for its emitted value to satisfy
13
13
  * a predicate, and then resolves with that value.
14
+ * Will throw if the desired state is not reached after a timeout
15
+ * (defaults to 10 seconds).
14
16
  *
15
17
  * @example
16
18
  * ```js
package/es/waitFor.js CHANGED
@@ -7,6 +7,8 @@ var defaultWaitForOptions = {
7
7
  /**
8
8
  * Subscribes to an actor ref and waits for its emitted value to satisfy
9
9
  * a predicate, and then resolves with that value.
10
+ * Will throw if the desired state is not reached after a timeout
11
+ * (defaults to 10 seconds).
10
12
  *
11
13
  * @example
12
14
  * ```js
package/lib/Machine.js CHANGED
@@ -14,7 +14,7 @@ function Machine(config, options, initialContext) {
14
14
  return new StateNode.StateNode(config, options, initialContext);
15
15
  }
16
16
  function createMachine(config, options) {
17
- if (!environment.IS_PRODUCTION && !config.predictableActionArguments && !warned) {
17
+ if (!environment.IS_PRODUCTION && !('predictableActionArguments' in config) && !warned) {
18
18
  warned = true;
19
19
  console.warn('It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html');
20
20
  }
@@ -189,7 +189,7 @@ declare class StateNode<TContext = any, TStateSchema extends StateSchema = any,
189
189
  private _transition;
190
190
  getTransitionData(state: State<TContext, TEvent, any, any, any>, event: Event<TEvent> | SCXML.Event<TEvent>): StateTransition<TContext, TEvent> | undefined;
191
191
  private next;
192
- private getExternalReentryNodes;
192
+ private getPotentiallyReenteringNodes;
193
193
  private getActions;
194
194
  /**
195
195
  * Determines the next state given the current `state` and sent `event`.
package/lib/StateNode.js CHANGED
@@ -524,15 +524,11 @@ function () {
524
524
  return this.next(state, _event);
525
525
  }
526
526
 
527
- var entryNodes = utils.flatten(stateTransitions.map(function (t) {
528
- return t.entrySet;
529
- }));
530
527
  var configuration = utils.flatten(Object.keys(transitionMap).map(function (key) {
531
528
  return transitionMap[key].configuration;
532
529
  }));
533
530
  return {
534
531
  transitions: enabledTransitions,
535
- entrySet: entryNodes,
536
532
  exitSet: utils.flatten(stateTransitions.map(function (t) {
537
533
  return t.exitSet;
538
534
  })),
@@ -619,7 +615,6 @@ function () {
619
615
  if (!nextStateNodes.length) {
620
616
  return {
621
617
  transitions: [selectedTransition],
622
- entrySet: [],
623
618
  exitSet: [],
624
619
  configuration: state.value ? [this] : [],
625
620
  source: state,
@@ -631,30 +626,28 @@ function () {
631
626
  return _this.getRelativeStateNodes(stateNode, state.historyValue);
632
627
  }));
633
628
  var isInternal = !!selectedTransition.internal;
634
- var reentryNodes = [];
635
-
636
- if (!isInternal) {
637
- nextStateNodes.forEach(function (targetNode) {
638
- reentryNodes.push.apply(reentryNodes, _tslib.__spreadArray([], _tslib.__read(_this.getExternalReentryNodes(targetNode)), false));
639
- });
640
- }
641
-
642
629
  return {
643
630
  transitions: [selectedTransition],
644
- entrySet: reentryNodes,
645
- exitSet: isInternal ? [] : [this],
631
+ exitSet: isInternal ? [] : utils.flatten(nextStateNodes.map(function (targetNode) {
632
+ return _this.getPotentiallyReenteringNodes(targetNode);
633
+ })),
646
634
  configuration: allNextStateNodes,
647
635
  source: state,
648
636
  actions: actions
649
637
  };
650
- };
638
+ }; // even though the name of this function mentions reentry nodes
639
+ // we are pushing its result into `exitSet`
640
+ // that's because what we exit might be reentered (it's an invariant of reentrancy)
651
641
 
652
- StateNode.prototype.getExternalReentryNodes = function (targetNode) {
653
- var nodes = [];
654
642
 
655
- var _a = _tslib.__read(targetNode.order > this.order ? [targetNode, this] : [this, targetNode], 2),
656
- marker = _a[0],
657
- possibleAncestor = _a[1];
643
+ StateNode.prototype.getPotentiallyReenteringNodes = function (targetNode) {
644
+ if (this.order < targetNode.order) {
645
+ return [this];
646
+ }
647
+
648
+ var nodes = [];
649
+ var marker = this;
650
+ var possibleAncestor = targetNode;
658
651
 
659
652
  while (marker && marker !== possibleAncestor) {
660
653
  nodes.push(marker);
@@ -676,14 +669,17 @@ function () {
676
669
 
677
670
  var _this = this;
678
671
 
679
- var prevConfig = stateUtils.getConfiguration([], prevState ? this.getStateNodes(prevState.value) : [this]);
672
+ var prevConfig = prevState ? stateUtils.getConfiguration([], this.getStateNodes(prevState.value)) : [];
673
+ var entrySet = new Set();
680
674
 
681
675
  try {
682
- for (var resolvedConfig_1 = _tslib.__values(resolvedConfig), resolvedConfig_1_1 = resolvedConfig_1.next(); !resolvedConfig_1_1.done; resolvedConfig_1_1 = resolvedConfig_1.next()) {
683
- var sn = resolvedConfig_1_1.value;
676
+ for (var _c = _tslib.__values(Array.from(resolvedConfig).sort(function (a, b) {
677
+ return a.order - b.order;
678
+ })), _d = _c.next(); !_d.done; _d = _c.next()) {
679
+ var sn = _d.value;
684
680
 
685
- if (!stateUtils.has(prevConfig, sn) || stateUtils.has(transition.entrySet, sn.parent) && !stateUtils.has(transition.entrySet, sn)) {
686
- transition.entrySet.push(sn);
681
+ if (!stateUtils.has(prevConfig, sn) || stateUtils.has(transition.exitSet, sn) || sn.parent && entrySet.has(sn.parent)) {
682
+ entrySet.add(sn);
687
683
  }
688
684
  }
689
685
  } catch (e_4_1) {
@@ -692,7 +688,7 @@ function () {
692
688
  };
693
689
  } finally {
694
690
  try {
695
- if (resolvedConfig_1_1 && !resolvedConfig_1_1.done && (_a = resolvedConfig_1.return)) _a.call(resolvedConfig_1);
691
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
696
692
  } finally {
697
693
  if (e_4) throw e_4.error;
698
694
  }
@@ -718,7 +714,14 @@ function () {
718
714
  }
719
715
  }
720
716
 
721
- var doneEvents = utils.flatten(transition.entrySet.map(function (sn) {
717
+ transition.exitSet.sort(function (a, b) {
718
+ return b.order - a.order;
719
+ });
720
+ var entryStates = Array.from(entrySet).sort(function (a, b) {
721
+ return a.order - b.order;
722
+ });
723
+ var exitStates = new Set(transition.exitSet);
724
+ var doneEvents = utils.flatten(entryStates.map(function (sn) {
722
725
  var events = [];
723
726
 
724
727
  if (sn.type !== 'final') {
@@ -745,27 +748,31 @@ function () {
745
748
 
746
749
  return events;
747
750
  }));
748
- transition.exitSet.sort(function (a, b) {
749
- return b.order - a.order;
750
- });
751
- transition.entrySet.sort(function (a, b) {
752
- return a.order - b.order;
753
- });
754
- var entryStates = new Set(transition.entrySet);
755
- var exitStates = new Set(transition.exitSet);
756
- var entryActions = Array.from(entryStates).map(function (stateNode) {
751
+ var entryActions = entryStates.map(function (stateNode) {
757
752
  var entryActions = stateNode.onEntry;
758
753
  var invokeActions = stateNode.activities.map(function (activity) {
759
754
  return actions.start(activity);
760
755
  });
761
- return actions.toActionObjects(predictableExec ? _tslib.__spreadArray(_tslib.__spreadArray([], _tslib.__read(entryActions), false), _tslib.__read(invokeActions), false) : _tslib.__spreadArray(_tslib.__spreadArray([], _tslib.__read(invokeActions), false), _tslib.__read(entryActions), false), _this.machine.options.actions);
762
- }).concat([doneEvents.map(actions.raise)]);
756
+ return {
757
+ type: 'entry',
758
+ actions: actions.toActionObjects(predictableExec ? _tslib.__spreadArray(_tslib.__spreadArray([], _tslib.__read(entryActions), false), _tslib.__read(invokeActions), false) : _tslib.__spreadArray(_tslib.__spreadArray([], _tslib.__read(invokeActions), false), _tslib.__read(entryActions), false), _this.machine.options.actions)
759
+ };
760
+ }).concat({
761
+ type: 'state_done',
762
+ actions: doneEvents.map(actions.raise)
763
+ });
763
764
  var exitActions = Array.from(exitStates).map(function (stateNode) {
764
- return actions.toActionObjects(_tslib.__spreadArray(_tslib.__spreadArray([], _tslib.__read(stateNode.onExit), false), _tslib.__read(stateNode.activities.map(function (activity) {
765
- return actions.stop(activity);
766
- })), false), _this.machine.options.actions);
765
+ return {
766
+ type: 'exit',
767
+ actions: actions.toActionObjects(_tslib.__spreadArray(_tslib.__spreadArray([], _tslib.__read(stateNode.onExit), false), _tslib.__read(stateNode.activities.map(function (activity) {
768
+ return actions.stop(activity);
769
+ })), false), _this.machine.options.actions)
770
+ };
767
771
  });
768
- var actions$1 = exitActions.concat([actions.toActionObjects(transition.actions, this.machine.options.actions)]).concat(entryActions);
772
+ var actions$1 = exitActions.concat({
773
+ type: 'transition',
774
+ actions: actions.toActionObjects(transition.actions, this.machine.options.actions)
775
+ }).concat(entryActions);
769
776
 
770
777
  if (isDone) {
771
778
  var stopActions = actions.toActionObjects(utils.flatten(_tslib.__spreadArray([], _tslib.__read(resolvedConfig), false).sort(function (a, b) {
@@ -775,7 +782,10 @@ function () {
775
782
  })), this.machine.options.actions).filter(function (action) {
776
783
  return action.type !== actionTypes.raise && (action.type !== actionTypes.send || !!action.to && action.to !== types.SpecialTargets.Internal);
777
784
  });
778
- return actions$1.concat([stopActions]);
785
+ return actions$1.concat({
786
+ type: 'stop',
787
+ actions: stopActions
788
+ });
779
789
  }
780
790
 
781
791
  return actions$1;
@@ -819,7 +829,6 @@ function () {
819
829
  var stateTransition = this._transition(currentState.value, currentState, _event) || {
820
830
  transitions: [],
821
831
  configuration: [],
822
- entrySet: [],
823
832
  exitSet: [],
824
833
  source: currentState,
825
834
  actions: []
@@ -871,8 +880,8 @@ function () {
871
880
  var block = actionBlocks_1_1.value;
872
881
 
873
882
  try {
874
- for (var block_1 = (e_7 = void 0, _tslib.__values(block)), block_1_1 = block_1.next(); !block_1_1.done; block_1_1 = block_1.next()) {
875
- var action = block_1_1.value;
883
+ for (var _c = (e_7 = void 0, _tslib.__values(block.actions)), _d = _c.next(); !_d.done; _d = _c.next()) {
884
+ var action = _d.value;
876
885
 
877
886
  if (action.type === actionTypes.start) {
878
887
  activities[action.activity.id || action.activity.type] = action;
@@ -886,7 +895,7 @@ function () {
886
895
  };
887
896
  } finally {
888
897
  try {
889
- if (block_1_1 && !block_1_1.done && (_b = block_1.return)) _b.call(block_1);
898
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
890
899
  } finally {
891
900
  if (e_7) throw e_7.error;
892
901
  }
@@ -904,15 +913,15 @@ function () {
904
913
  }
905
914
  }
906
915
 
907
- var _c = _tslib.__read(actions.resolveActions(this, currentState, context, _event, actionBlocks, predictableExec, this.machine.config.predictableActionArguments || this.machine.config.preserveActionOrder), 2),
908
- resolvedActions = _c[0],
909
- updatedContext = _c[1];
916
+ var _e = _tslib.__read(actions.resolveActions(this, currentState, context, _event, actionBlocks, predictableExec, this.machine.config.predictableActionArguments || this.machine.config.preserveActionOrder), 2),
917
+ resolvedActions = _e[0],
918
+ updatedContext = _e[1];
910
919
 
911
- var _d = _tslib.__read(utils.partition(resolvedActions, function (action) {
920
+ var _f = _tslib.__read(utils.partition(resolvedActions, function (action) {
912
921
  return action.type === actionTypes.raise || action.type === actionTypes.send && action.to === types.SpecialTargets.Internal;
913
922
  }), 2),
914
- raisedEvents = _d[0],
915
- nonRaisedActions = _d[1];
923
+ raisedEvents = _f[0],
924
+ nonRaisedActions = _f[1];
916
925
 
917
926
  var invokeActions = resolvedActions.filter(function (action) {
918
927
  var _a;
@@ -1165,7 +1174,6 @@ function () {
1165
1174
  var configuration = this.getStateNodes(stateValue);
1166
1175
  return this.resolveTransition({
1167
1176
  configuration: configuration,
1168
- entrySet: configuration,
1169
1177
  exitSet: [],
1170
1178
  transitions: [],
1171
1179
  source: undefined,
package/lib/actions.d.ts CHANGED
@@ -133,7 +133,7 @@ export declare function done(id: string, data?: any): DoneEventObject;
133
133
  */
134
134
  export declare function doneInvoke(id: string, data?: any): DoneEvent;
135
135
  export declare function error(id: string, data?: any): ErrorPlatformEvent & string;
136
- export declare function pure<TContext, TEvent extends EventObject>(getActions: (context: TContext, event: TEvent) => SingleOrArray<ActionObject<TContext, TEvent>> | undefined): PureAction<TContext, TEvent>;
136
+ export declare function pure<TContext, TEvent extends EventObject>(getActions: (context: TContext, event: TEvent) => SingleOrArray<ActionObject<TContext, TEvent> | ActionObject<TContext, TEvent>['type']> | undefined): PureAction<TContext, TEvent>;
137
137
  /**
138
138
  * Forwards (sends) an event to a specified service.
139
139
  *
@@ -150,5 +150,8 @@ export declare function forwardTo<TContext, TEvent extends EventObject>(target:
150
150
  */
151
151
  export declare function escalate<TContext, TEvent extends EventObject, TErrorData = any>(errorData: TErrorData | ExprWithMeta<TContext, TEvent, TErrorData>, options?: SendActionOptions<TContext, TEvent>): SendAction<TContext, TEvent, AnyEventObject>;
152
152
  export declare function choose<TContext, TEvent extends EventObject>(conds: Array<ChooseCondition<TContext, TEvent>>): ChooseAction<TContext, TEvent>;
153
- export declare function resolveActions<TContext, TEvent extends EventObject>(machine: StateNode<TContext, any, TEvent, any, any, any>, currentState: State<TContext, TEvent, any, any, any> | undefined, currentContext: TContext, _event: SCXML.Event<TEvent>, actionBlocks: Array<Array<ActionObject<TContext, TEvent>>>, predictableExec?: PredictableActionArgumentsExec, preserveActionOrder?: boolean): [Array<ActionObject<TContext, TEvent>>, TContext];
153
+ export declare function resolveActions<TContext, TEvent extends EventObject>(machine: StateNode<TContext, any, TEvent, any, any, any>, currentState: State<TContext, TEvent, any, any, any> | undefined, currentContext: TContext, _event: SCXML.Event<TEvent>, actionBlocks: Array<{
154
+ type: string;
155
+ actions: Array<ActionObject<TContext, TEvent>>;
156
+ }>, predictableExec?: PredictableActionArgumentsExec, preserveActionOrder?: boolean): [Array<ActionObject<TContext, TEvent>>, TContext];
154
157
  //# sourceMappingURL=actions.d.ts.map
package/lib/actions.js CHANGED
@@ -439,10 +439,10 @@ var pluckAssigns = function (actionBlocks) {
439
439
  var block = actionBlocks_1_1.value;
440
440
  var i = 0;
441
441
 
442
- while (i < block.length) {
443
- if (block[i].type === actionTypes.assign) {
444
- assignActions.push(block[i]);
445
- block.splice(i, 1);
442
+ while (i < block.actions.length) {
443
+ if (block.actions[i].type === actionTypes.assign) {
444
+ assignActions.push(block.actions[i]);
445
+ block.actions.splice(i, 1);
446
446
  continue;
447
447
  }
448
448
 
@@ -474,7 +474,7 @@ function resolveActions(machine, currentState, currentContext, _event, actionBlo
474
474
  var preservedContexts = preserveActionOrder ? [currentContext] : undefined;
475
475
  var deferredToBlockEnd = [];
476
476
 
477
- function handleAction(actionObject) {
477
+ function handleAction(blockType, actionObject) {
478
478
  var _a;
479
479
 
480
480
  switch (actionObject.type) {
@@ -493,7 +493,11 @@ function resolveActions(machine, currentState, currentContext, _event, actionBlo
493
493
  }
494
494
 
495
495
  if (predictableExec && sendAction.to !== types.SpecialTargets.Internal) {
496
- deferredToBlockEnd.push(sendAction);
496
+ if (blockType === 'entry') {
497
+ deferredToBlockEnd.push(sendAction);
498
+ } else {
499
+ predictableExec === null || predictableExec === void 0 ? void 0 : predictableExec(sendAction, updatedContext, _event);
500
+ }
497
501
  }
498
502
 
499
503
  return sendAction;
@@ -517,7 +521,10 @@ function resolveActions(machine, currentState, currentContext, _event, actionBlo
517
521
  return [];
518
522
  }
519
523
 
520
- var _b = _tslib.__read(resolveActions(machine, currentState, updatedContext, _event, [toActionObjects(utils.toArray(matchedActions), machine.options.actions)], predictableExec, preserveActionOrder), 2),
524
+ var _b = _tslib.__read(resolveActions(machine, currentState, updatedContext, _event, [{
525
+ type: blockType,
526
+ actions: toActionObjects(utils.toArray(matchedActions), machine.options.actions)
527
+ }], predictableExec, preserveActionOrder), 2),
521
528
  resolvedActionsFromChoose = _b[0],
522
529
  resolvedContextFromChoose = _b[1];
523
530
 
@@ -534,7 +541,10 @@ function resolveActions(machine, currentState, currentContext, _event, actionBlo
534
541
  return [];
535
542
  }
536
543
 
537
- var _c = _tslib.__read(resolveActions(machine, currentState, updatedContext, _event, [toActionObjects(utils.toArray(matchedActions), machine.options.actions)], predictableExec, preserveActionOrder), 2),
544
+ var _c = _tslib.__read(resolveActions(machine, currentState, updatedContext, _event, [{
545
+ type: blockType,
546
+ actions: toActionObjects(utils.toArray(matchedActions), machine.options.actions)
547
+ }], predictableExec, preserveActionOrder), 2),
538
548
  resolvedActionsFromPure = _c[0],
539
549
  resolvedContext = _c[1];
540
550
 
@@ -588,9 +598,9 @@ function resolveActions(machine, currentState, currentContext, _event, actionBlo
588
598
  var resolvedActions = [];
589
599
 
590
600
  try {
591
- for (var block_1 = _tslib.__values(block), block_1_1 = block_1.next(); !block_1_1.done; block_1_1 = block_1.next()) {
592
- var action = block_1_1.value;
593
- var resolved = handleAction(action);
601
+ for (var _b = _tslib.__values(block.actions), _c = _b.next(); !_c.done; _c = _b.next()) {
602
+ var action = _c.value;
603
+ var resolved = handleAction(block.type, action);
594
604
 
595
605
  if (resolved) {
596
606
  resolvedActions = resolvedActions.concat(resolved);
@@ -602,7 +612,7 @@ function resolveActions(machine, currentState, currentContext, _event, actionBlo
602
612
  };
603
613
  } finally {
604
614
  try {
605
- if (block_1_1 && !block_1_1.done && (_a = block_1.return)) _a.call(block_1);
615
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
606
616
  } finally {
607
617
  if (e_2) throw e_2.error;
608
618
  }
@@ -805,7 +805,10 @@ function () {
805
805
  return actions.toActionObjects(stateNode.onExit, _this.machine.options.actions);
806
806
  }));
807
807
 
808
- var _a = _tslib.__read(actions.resolveActions(_this.machine, _this.state, _this.state.context, _event, [exitActions], _this.machine.config.predictableActionArguments ? _this._exec : undefined, _this.machine.config.predictableActionArguments || _this.machine.config.preserveActionOrder), 2),
808
+ var _a = _tslib.__read(actions.resolveActions(_this.machine, _this.state, _this.state.context, _event, [{
809
+ type: 'exit',
810
+ actions: exitActions
811
+ }], _this.machine.config.predictableActionArguments ? _this._exec : undefined, _this.machine.config.predictableActionArguments || _this.machine.config.preserveActionOrder), 2),
809
812
  resolvedActions = _a[0],
810
813
  updatedContext = _a[1];
811
814
 
package/lib/model.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import type { Cast, EventObject, BaseActionObject, Prop, IsNever } from './types';
2
2
  import { UnionFromCreatorsReturnTypes, FinalModelCreators, Model, ModelCreators } from './model.types';
3
+ /**
4
+ * @deprecated Use [Typegen](https://stately.ai/blog/introducing-typescript-typegen-for-xstate) instead.
5
+ */
3
6
  export declare function createModel<TContext, TEvent extends EventObject, TAction extends BaseActionObject = BaseActionObject>(initialContext: TContext): Model<TContext, TEvent, TAction, void>;
4
7
  export declare function createModel<TContext, TModelCreators extends ModelCreators<TModelCreators>, TFinalModelCreators = FinalModelCreators<TModelCreators>, TComputedEvent = UnionFromCreatorsReturnTypes<Prop<TFinalModelCreators, 'events'>>, TComputedAction = UnionFromCreatorsReturnTypes<Prop<TFinalModelCreators, 'actions'>>>(initialContext: TContext, creators: TModelCreators): Model<TContext, Cast<TComputedEvent, EventObject>, IsNever<TComputedAction> extends true ? BaseActionObject : Cast<TComputedAction, BaseActionObject>, TFinalModelCreators>;
5
8
  //# sourceMappingURL=model.d.ts.map
package/lib/types.d.ts CHANGED
@@ -610,7 +610,6 @@ export interface ActivityMap {
610
610
  export interface StateTransition<TContext, TEvent extends EventObject> {
611
611
  transitions: Array<TransitionDefinition<TContext, TEvent>>;
612
612
  configuration: Array<StateNode<TContext, any, TEvent, any, any, any>>;
613
- entrySet: Array<StateNode<TContext, any, TEvent, any, any, any>>;
614
613
  exitSet: Array<StateNode<TContext, any, TEvent, any, any, any>>;
615
614
  /**
616
615
  * The source state that preceded the transition.
@@ -754,7 +753,7 @@ export interface AssignAction<TContext, TEvent extends EventObject> extends Acti
754
753
  }
755
754
  export interface PureAction<TContext, TEvent extends EventObject> extends ActionObject<TContext, TEvent> {
756
755
  type: ActionTypes.Pure;
757
- get: (context: TContext, event: TEvent) => SingleOrArray<ActionObject<TContext, TEvent>> | undefined;
756
+ get: (context: TContext, event: TEvent) => SingleOrArray<ActionObject<TContext, TEvent> | ActionObject<TContext, TEvent>['type']> | undefined;
758
757
  }
759
758
  export interface ChooseAction<TContext, TEvent extends EventObject> extends ActionObject<TContext, TEvent> {
760
759
  type: ActionTypes.Choose;
package/lib/waitFor.d.ts CHANGED
@@ -11,6 +11,8 @@ interface WaitForOptions {
11
11
  /**
12
12
  * Subscribes to an actor ref and waits for its emitted value to satisfy
13
13
  * a predicate, and then resolves with that value.
14
+ * Will throw if the desired state is not reached after a timeout
15
+ * (defaults to 10 seconds).
14
16
  *
15
17
  * @example
16
18
  * ```js
package/lib/waitFor.js CHANGED
@@ -11,6 +11,8 @@ var defaultWaitForOptions = {
11
11
  /**
12
12
  * Subscribes to an actor ref and waits for its emitted value to satisfy
13
13
  * a predicate, and then resolves with that value.
14
+ * Will throw if the desired state is not reached after a timeout
15
+ * (defaults to 10 seconds).
14
16
  *
15
17
  * @example
16
18
  * ```js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xstate",
3
- "version": "4.34.0",
3
+ "version": "4.35.1",
4
4
  "description": "Finite State Machines and Statecharts for the Modern Web.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -63,7 +63,7 @@
63
63
  "rxjs": "^7.1.0",
64
64
  "ts-jest": "^26.5.6",
65
65
  "tslib": "^2.3.1",
66
- "typescript": "^4.8.2",
66
+ "typescript": "^4.8.4",
67
67
  "xml-js": "^1.6.11"
68
68
  }
69
69
  }