xstate 5.0.0-beta.19 → 5.0.0-beta.20

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.
Files changed (43) hide show
  1. package/actions/dist/xstate-actions.cjs.js +1 -1
  2. package/actions/dist/xstate-actions.development.cjs.js +1 -1
  3. package/actions/dist/xstate-actions.development.esm.js +1 -1
  4. package/actions/dist/xstate-actions.esm.js +1 -1
  5. package/actions/dist/xstate-actions.umd.min.js.map +1 -1
  6. package/actors/dist/xstate-actors.cjs.js +1 -1
  7. package/actors/dist/xstate-actors.development.cjs.js +1 -1
  8. package/actors/dist/xstate-actors.development.esm.js +1 -1
  9. package/actors/dist/xstate-actors.esm.js +1 -1
  10. package/actors/dist/xstate-actors.umd.min.js +1 -1
  11. package/actors/dist/xstate-actors.umd.min.js.map +1 -1
  12. package/dist/{actions-2d912781.cjs.js → actions-069d9805.cjs.js} +307 -311
  13. package/dist/{actions-3b74fb92.esm.js → actions-a8a9433c.esm.js} +307 -311
  14. package/dist/{actions-72105f77.development.esm.js → actions-b299d008.development.esm.js} +307 -311
  15. package/dist/{actions-bce11b97.development.cjs.js → actions-d1c41ed3.development.cjs.js} +307 -311
  16. package/dist/declarations/src/Machine.d.ts +2 -2
  17. package/dist/declarations/src/State.d.ts +15 -4
  18. package/dist/declarations/src/StateMachine.d.ts +16 -16
  19. package/dist/declarations/src/StateNode.d.ts +4 -4
  20. package/dist/declarations/src/actions/send.d.ts +1 -1
  21. package/dist/declarations/src/actions/stop.d.ts +1 -1
  22. package/dist/declarations/src/actors/callback.d.ts +13 -3
  23. package/dist/declarations/src/actors/index.d.ts +4 -4
  24. package/dist/declarations/src/actors/observable.d.ts +8 -8
  25. package/dist/declarations/src/actors/promise.d.ts +12 -6
  26. package/dist/declarations/src/actors/transition.d.ts +6 -6
  27. package/dist/declarations/src/guards.d.ts +2 -2
  28. package/dist/declarations/src/stateUtils.d.ts +8 -8
  29. package/dist/declarations/src/typegenTypes.d.ts +15 -17
  30. package/dist/declarations/src/types.d.ts +99 -59
  31. package/dist/declarations/src/utils.d.ts +2 -2
  32. package/dist/xstate.cjs.js +2 -3
  33. package/dist/xstate.development.cjs.js +2 -3
  34. package/dist/xstate.development.esm.js +3 -4
  35. package/dist/xstate.esm.js +3 -4
  36. package/dist/xstate.umd.min.js +1 -1
  37. package/dist/xstate.umd.min.js.map +1 -1
  38. package/guards/dist/xstate-guards.cjs.js +1 -1
  39. package/guards/dist/xstate-guards.development.cjs.js +1 -1
  40. package/guards/dist/xstate-guards.development.esm.js +1 -1
  41. package/guards/dist/xstate-guards.esm.js +1 -1
  42. package/guards/dist/xstate-guards.umd.min.js.map +1 -1
  43. package/package.json +1 -1
@@ -2,9 +2,6 @@ import { devToolsAdapter } from '../dev/dist/xstate-dev.esm.js';
2
2
 
3
3
  // https://github.com/microsoft/TypeScript/issues/23182#issuecomment-379091887
4
4
 
5
- // TODO: replace in v5 with:
6
- // export type IndexByType<T extends { type: string }> = { [E in T as E['type']]: E; };
7
-
8
5
  /**
9
6
  * The full definition of an event, with a string `type`.
10
7
  */
@@ -13,8 +10,6 @@ import { devToolsAdapter } from '../dev/dist/xstate-dev.esm.js';
13
10
  // we should also accept a raw machine as actor logic here
14
11
  // or just make machine actor logic
15
12
 
16
- // TODO: narrow this to logic from machine
17
-
18
13
  /**
19
14
  * The string or object representing the state value relative to the parent state node.
20
15
  *
@@ -305,7 +300,7 @@ const symbolObservable = (() => typeof Symbol === 'function' && Symbol.observabl
305
300
  * @returns Actor logic
306
301
  */
307
302
  function fromTransition(transition, initialState) {
308
- const logic = {
303
+ return {
309
304
  config: transition,
310
305
  transition: (state, event, actorContext) => {
311
306
  return transition(state, event, actorContext);
@@ -319,96 +314,260 @@ function fromTransition(transition, initialState) {
319
314
  getPersistedState: state => state,
320
315
  restoreState: state => state
321
316
  };
322
- return logic;
323
317
  }
324
318
 
325
- const resolveEventType = '$$xstate.resolve';
326
- const rejectEventType = '$$xstate.reject';
327
- function fromPromise(
328
- // TODO: add types
329
- promiseCreator) {
330
- // TODO: add event types, consider making the `PromiseEvent` a private type or smth alike
319
+ function matchesState(parentStateId, childStateId) {
320
+ const parentStateValue = toStateValue(parentStateId);
321
+ const childStateValue = toStateValue(childStateId);
322
+ if (typeof childStateValue === 'string') {
323
+ if (typeof parentStateValue === 'string') {
324
+ return childStateValue === parentStateValue;
325
+ }
326
+
327
+ // Parent more specific than child
328
+ return false;
329
+ }
330
+ if (typeof parentStateValue === 'string') {
331
+ return parentStateValue in childStateValue;
332
+ }
333
+ return Object.keys(parentStateValue).every(key => {
334
+ if (!(key in childStateValue)) {
335
+ return false;
336
+ }
337
+ return matchesState(parentStateValue[key], childStateValue[key]);
338
+ });
339
+ }
340
+ function toStatePath(stateId) {
341
+ try {
342
+ if (isArray(stateId)) {
343
+ return stateId;
344
+ }
345
+ return stateId.toString().split(STATE_DELIMITER);
346
+ } catch (e) {
347
+ throw new Error(`'${stateId}' is not a valid state path.`);
348
+ }
349
+ }
350
+ function isStateLike(state) {
351
+ return typeof state === 'object' && 'value' in state && 'context' in state && 'event' in state;
352
+ }
353
+ function toStateValue(stateValue) {
354
+ if (isStateLike(stateValue)) {
355
+ return stateValue.value;
356
+ }
357
+ if (isArray(stateValue)) {
358
+ return pathToStateValue(stateValue);
359
+ }
360
+ if (typeof stateValue !== 'string') {
361
+ return stateValue;
362
+ }
363
+ const statePath = toStatePath(stateValue);
364
+ return pathToStateValue(statePath);
365
+ }
366
+ function pathToStateValue(statePath) {
367
+ if (statePath.length === 1) {
368
+ return statePath[0];
369
+ }
370
+ const value = {};
371
+ let marker = value;
372
+ for (let i = 0; i < statePath.length - 1; i++) {
373
+ if (i === statePath.length - 2) {
374
+ marker[statePath[i]] = statePath[i + 1];
375
+ } else {
376
+ const previous = marker;
377
+ marker = {};
378
+ previous[statePath[i]] = marker;
379
+ }
380
+ }
381
+ return value;
382
+ }
383
+ function mapValues(collection, iteratee) {
384
+ const result = {};
385
+ const collectionKeys = Object.keys(collection);
386
+ for (let i = 0; i < collectionKeys.length; i++) {
387
+ const key = collectionKeys[i];
388
+ result[key] = iteratee(collection[key], key, collection, i);
389
+ }
390
+ return result;
391
+ }
392
+ function flatten(array) {
393
+ return [].concat(...array);
394
+ }
395
+ function toArrayStrict(value) {
396
+ if (isArray(value)) {
397
+ return value;
398
+ }
399
+ return [value];
400
+ }
401
+ function toArray(value) {
402
+ if (value === undefined) {
403
+ return [];
404
+ }
405
+ return toArrayStrict(value);
406
+ }
407
+ function mapContext(mapper, context, event) {
408
+ if (typeof mapper === 'function') {
409
+ return mapper({
410
+ context,
411
+ event
412
+ });
413
+ }
414
+ const result = {};
415
+ const args = {
416
+ context,
417
+ event
418
+ };
419
+ for (const key of Object.keys(mapper)) {
420
+ const subMapper = mapper[key];
421
+ if (typeof subMapper === 'function') {
422
+ result[key] = subMapper(args);
423
+ } else {
424
+ result[key] = subMapper;
425
+ }
426
+ }
427
+ return result;
428
+ }
429
+ function isPromiseLike(value) {
430
+ if (value instanceof Promise) {
431
+ return true;
432
+ }
433
+ // Check if shape matches the Promise/A+ specification for a "thenable".
434
+ if (value !== null && (typeof value === 'function' || typeof value === 'object') && typeof value.then === 'function') {
435
+ return true;
436
+ }
437
+ return false;
438
+ }
439
+ function isArray(value) {
440
+ return Array.isArray(value);
441
+ }
442
+ function isErrorEvent(event) {
443
+ return typeof event.type === 'string' && (event.type === errorExecution || event.type.startsWith(errorPlatform));
444
+ }
445
+ function toTransitionConfigArray(configLike) {
446
+ return toArrayStrict(configLike).map(transitionLike => {
447
+ if (typeof transitionLike === 'undefined' || typeof transitionLike === 'string') {
448
+ return {
449
+ target: transitionLike
450
+ };
451
+ }
452
+ return transitionLike;
453
+ });
454
+ }
455
+ function normalizeTarget(target) {
456
+ if (target === undefined || target === TARGETLESS_KEY) {
457
+ return undefined;
458
+ }
459
+ return toArray(target);
460
+ }
461
+ function toInvokeConfig(invocable, id) {
462
+ if (typeof invocable === 'object') {
463
+ if ('src' in invocable) {
464
+ return invocable;
465
+ }
466
+ if ('transition' in invocable) {
467
+ return {
468
+ id,
469
+ src: invocable
470
+ };
471
+ }
472
+ }
473
+ return {
474
+ id,
475
+ src: invocable
476
+ };
477
+ }
478
+ function toObserver(nextHandler, errorHandler, completionHandler) {
479
+ const noop = () => {};
480
+ const isObserver = typeof nextHandler === 'object';
481
+ const self = isObserver ? nextHandler : null;
482
+ return {
483
+ next: ((isObserver ? nextHandler.next : nextHandler) || noop).bind(self),
484
+ error: ((isObserver ? nextHandler.error : errorHandler) || noop).bind(self),
485
+ complete: ((isObserver ? nextHandler.complete : completionHandler) || noop).bind(self)
486
+ };
487
+ }
488
+ function createInvokeId(stateNodeId, index) {
489
+ return `${stateNodeId}:invocation[${index}]`;
490
+ }
491
+ function resolveReferencedActor(referenced) {
492
+ return referenced ? 'transition' in referenced ? {
493
+ src: referenced,
494
+ input: undefined
495
+ } : referenced : undefined;
496
+ }
497
+
498
+ function fromCallback(invokeCallback) {
331
499
  const logic = {
332
- config: promiseCreator,
333
- transition: (state, event) => {
334
- if (state.status !== 'active') {
335
- return state;
336
- }
337
- switch (event.type) {
338
- case resolveEventType:
339
- return {
340
- ...state,
341
- status: 'done',
342
- data: event.data,
343
- input: undefined
344
- };
345
- case rejectEventType:
346
- return {
347
- ...state,
348
- status: 'error',
349
- data: event.data,
350
- input: undefined
351
- };
352
- case stopSignalType:
353
- return {
354
- ...state,
355
- status: 'canceled',
356
- input: undefined
357
- };
358
- default:
359
- return state;
360
- }
500
+ config: invokeCallback,
501
+ start: (_state, {
502
+ self
503
+ }) => {
504
+ self.send({
505
+ type: startSignalType
506
+ });
361
507
  },
362
- start: (state, {
508
+ transition: (state, event, {
363
509
  self,
510
+ id,
364
511
  system
365
512
  }) => {
366
- // TODO: determine how to allow customizing this so that promises
367
- // can be restarted if necessary
368
- if (state.status !== 'active') {
369
- return;
513
+ if (event.type === startSignalType) {
514
+ const sendBack = eventForParent => {
515
+ if (state.canceled) {
516
+ return;
517
+ }
518
+ self._parent?.send(eventForParent);
519
+ };
520
+ const receive = newListener => {
521
+ state.receivers.add(newListener);
522
+ };
523
+ state.dispose = invokeCallback({
524
+ input: state.input,
525
+ system,
526
+ self: self,
527
+ sendBack,
528
+ receive
529
+ });
530
+ if (isPromiseLike(state.dispose)) {
531
+ state.dispose.then(resolved => {
532
+ self._parent?.send(doneInvoke(id, resolved));
533
+ state.canceled = true;
534
+ }, errorData => {
535
+ state.canceled = true;
536
+ self._parent?.send(error(id, errorData));
537
+ });
538
+ }
539
+ return state;
370
540
  }
371
- const resolvedPromise = Promise.resolve(promiseCreator({
372
- input: state.input,
373
- system,
374
- self
375
- }));
376
- resolvedPromise.then(response => {
377
- // TODO: remove this condition once dead letter queue lands
378
- if (self._state.status !== 'active') {
379
- return;
380
- }
381
- self.send({
382
- type: resolveEventType,
383
- data: response
384
- });
385
- }, errorData => {
386
- // TODO: remove this condition once dead letter queue lands
387
- if (self._state.status !== 'active') {
388
- return;
541
+ if (event.type === stopSignalType) {
542
+ state.canceled = true;
543
+ if (typeof state.dispose === 'function') {
544
+ state.dispose();
389
545
  }
390
- self.send({
391
- type: rejectEventType,
392
- data: errorData
393
- });
394
- });
546
+ return state;
547
+ }
548
+ if (isSignal(event)) {
549
+ // TODO: unrecognized signal
550
+ return state;
551
+ }
552
+ state.receivers.forEach(receiver => receiver(event));
553
+ return state;
395
554
  },
396
555
  getInitialState: (_, input) => {
397
556
  return {
398
- status: 'active',
399
- data: undefined,
557
+ canceled: false,
558
+ receivers: new Set(),
559
+ dispose: undefined,
400
560
  input
401
561
  };
402
562
  },
403
- getSnapshot: state => state.data,
404
- getStatus: state => state,
405
- getPersistedState: state => state,
406
- restoreState: state => state
563
+ getSnapshot: () => undefined,
564
+ getPersistedState: ({
565
+ input
566
+ }) => input
407
567
  };
408
568
  return logic;
409
569
  }
410
570
 
411
- // TODO: this likely shouldn't accept TEvent, observable actor doesn't accept external events
412
571
  function fromObservable(observableCreator) {
413
572
  const nextEventType = '$$xstate.next';
414
573
  const errorEventType = '$$xstate.error';
@@ -629,252 +788,88 @@ function fromEventObservable(lazyObservable) {
629
788
  return logic;
630
789
  }
631
790
 
632
- function matchesState(parentStateId, childStateId) {
633
- const parentStateValue = toStateValue(parentStateId);
634
- const childStateValue = toStateValue(childStateId);
635
- if (typeof childStateValue === 'string') {
636
- if (typeof parentStateValue === 'string') {
637
- return childStateValue === parentStateValue;
638
- }
639
-
640
- // Parent more specific than child
641
- return false;
642
- }
643
- if (typeof parentStateValue === 'string') {
644
- return parentStateValue in childStateValue;
645
- }
646
- return Object.keys(parentStateValue).every(key => {
647
- if (!(key in childStateValue)) {
648
- return false;
649
- }
650
- return matchesState(parentStateValue[key], childStateValue[key]);
651
- });
652
- }
653
- function toStatePath(stateId) {
654
- try {
655
- if (isArray(stateId)) {
656
- return stateId;
657
- }
658
- return stateId.toString().split(STATE_DELIMITER);
659
- } catch (e) {
660
- throw new Error(`'${stateId}' is not a valid state path.`);
661
- }
662
- }
663
- function isStateLike(state) {
664
- return typeof state === 'object' && 'value' in state && 'context' in state && 'event' in state;
665
- }
666
- function toStateValue(stateValue) {
667
- if (isStateLike(stateValue)) {
668
- return stateValue.value;
669
- }
670
- if (isArray(stateValue)) {
671
- return pathToStateValue(stateValue);
672
- }
673
- if (typeof stateValue !== 'string') {
674
- return stateValue;
675
- }
676
- const statePath = toStatePath(stateValue);
677
- return pathToStateValue(statePath);
678
- }
679
- function pathToStateValue(statePath) {
680
- if (statePath.length === 1) {
681
- return statePath[0];
682
- }
683
- const value = {};
684
- let marker = value;
685
- for (let i = 0; i < statePath.length - 1; i++) {
686
- if (i === statePath.length - 2) {
687
- marker[statePath[i]] = statePath[i + 1];
688
- } else {
689
- const previous = marker;
690
- marker = {};
691
- previous[statePath[i]] = marker;
692
- }
693
- }
694
- return value;
695
- }
696
- function mapValues(collection, iteratee) {
697
- const result = {};
698
- const collectionKeys = Object.keys(collection);
699
- for (let i = 0; i < collectionKeys.length; i++) {
700
- const key = collectionKeys[i];
701
- result[key] = iteratee(collection[key], key, collection, i);
702
- }
703
- return result;
704
- }
705
- function flatten(array) {
706
- return [].concat(...array);
707
- }
708
- function toArrayStrict(value) {
709
- if (isArray(value)) {
710
- return value;
711
- }
712
- return [value];
713
- }
714
- function toArray(value) {
715
- if (value === undefined) {
716
- return [];
717
- }
718
- return toArrayStrict(value);
719
- }
720
- function mapContext(mapper, context, event) {
721
- if (typeof mapper === 'function') {
722
- return mapper({
723
- context,
724
- event
725
- });
726
- }
727
- const result = {};
728
- const args = {
729
- context,
730
- event
731
- };
732
- for (const key of Object.keys(mapper)) {
733
- const subMapper = mapper[key];
734
- if (typeof subMapper === 'function') {
735
- result[key] = subMapper(args);
736
- } else {
737
- result[key] = subMapper;
738
- }
739
- }
740
- return result;
741
- }
742
- function isPromiseLike(value) {
743
- if (value instanceof Promise) {
744
- return true;
745
- }
746
- // Check if shape matches the Promise/A+ specification for a "thenable".
747
- if (value !== null && (typeof value === 'function' || typeof value === 'object') && typeof value.then === 'function') {
748
- return true;
749
- }
750
- return false;
751
- }
752
- function isArray(value) {
753
- return Array.isArray(value);
754
- }
755
- function isErrorEvent(event) {
756
- return typeof event.type === 'string' && (event.type === errorExecution || event.type.startsWith(errorPlatform));
757
- }
758
- function toTransitionConfigArray(configLike) {
759
- return toArrayStrict(configLike).map(transitionLike => {
760
- if (typeof transitionLike === 'undefined' || typeof transitionLike === 'string') {
761
- return {
762
- target: transitionLike
763
- };
764
- }
765
- return transitionLike;
766
- });
767
- }
768
- function normalizeTarget(target) {
769
- if (target === undefined || target === TARGETLESS_KEY) {
770
- return undefined;
771
- }
772
- return toArray(target);
773
- }
774
- function toInvokeConfig(invocable, id) {
775
- if (typeof invocable === 'object') {
776
- if ('src' in invocable) {
777
- return invocable;
778
- }
779
- if ('transition' in invocable) {
780
- return {
781
- id,
782
- src: invocable
783
- };
784
- }
785
- }
786
- return {
787
- id,
788
- src: invocable
789
- };
790
- }
791
- function toObserver(nextHandler, errorHandler, completionHandler) {
792
- const noop = () => {};
793
- const isObserver = typeof nextHandler === 'object';
794
- const self = isObserver ? nextHandler : null;
795
- return {
796
- next: ((isObserver ? nextHandler.next : nextHandler) || noop).bind(self),
797
- error: ((isObserver ? nextHandler.error : errorHandler) || noop).bind(self),
798
- complete: ((isObserver ? nextHandler.complete : completionHandler) || noop).bind(self)
799
- };
800
- }
801
- function createInvokeId(stateNodeId, index) {
802
- return `${stateNodeId}:invocation[${index}]`;
803
- }
804
- function resolveReferencedActor(referenced) {
805
- return referenced ? 'transition' in referenced ? {
806
- src: referenced,
807
- input: undefined
808
- } : referenced : undefined;
809
- }
810
-
811
- function fromCallback(invokeCallback) {
791
+ const resolveEventType = '$$xstate.resolve';
792
+ const rejectEventType = '$$xstate.reject';
793
+ function fromPromise(
794
+ // TODO: add types
795
+ promiseCreator) {
796
+ // TODO: add event types
812
797
  const logic = {
813
- config: invokeCallback,
814
- start: (_state, {
815
- self
816
- }) => {
817
- self.send({
818
- type: startSignalType
819
- });
798
+ config: promiseCreator,
799
+ transition: (state, event) => {
800
+ if (state.status !== 'active') {
801
+ return state;
802
+ }
803
+ switch (event.type) {
804
+ case resolveEventType:
805
+ return {
806
+ ...state,
807
+ status: 'done',
808
+ data: event.data,
809
+ input: undefined
810
+ };
811
+ case rejectEventType:
812
+ return {
813
+ ...state,
814
+ status: 'error',
815
+ data: event.data,
816
+ input: undefined
817
+ };
818
+ case stopSignalType:
819
+ return {
820
+ ...state,
821
+ status: 'canceled',
822
+ input: undefined
823
+ };
824
+ default:
825
+ return state;
826
+ }
820
827
  },
821
- transition: (state, event, {
828
+ start: (state, {
822
829
  self,
823
- id,
824
830
  system
825
831
  }) => {
826
- if (event.type === startSignalType) {
827
- const sender = eventForParent => {
828
- if (state.canceled) {
829
- return;
830
- }
831
- self._parent?.send(eventForParent);
832
- };
833
- const receiver = newListener => {
834
- state.receivers.add(newListener);
835
- };
836
- state.dispose = invokeCallback(sender, receiver, {
837
- input: state.input,
838
- system,
839
- self: self
840
- });
841
- if (isPromiseLike(state.dispose)) {
842
- state.dispose.then(resolved => {
843
- self._parent?.send(doneInvoke(id, resolved));
844
- state.canceled = true;
845
- }, errorData => {
846
- state.canceled = true;
847
- self._parent?.send(error(id, errorData));
848
- });
849
- }
850
- return state;
832
+ // TODO: determine how to allow customizing this so that promises
833
+ // can be restarted if necessary
834
+ if (state.status !== 'active') {
835
+ return;
851
836
  }
852
- if (event.type === stopSignalType) {
853
- state.canceled = true;
854
- if (typeof state.dispose === 'function') {
855
- state.dispose();
837
+ const resolvedPromise = Promise.resolve(promiseCreator({
838
+ input: state.input,
839
+ system,
840
+ self
841
+ }));
842
+ resolvedPromise.then(response => {
843
+ // TODO: remove this condition once dead letter queue lands
844
+ if (self._state.status !== 'active') {
845
+ return;
856
846
  }
857
- return state;
858
- }
859
- if (isSignal(event)) {
860
- // TODO: unrecognized signal
861
- return state;
862
- }
863
- state.receivers.forEach(receiver => receiver(event));
864
- return state;
847
+ self.send({
848
+ type: resolveEventType,
849
+ data: response
850
+ });
851
+ }, errorData => {
852
+ // TODO: remove this condition once dead letter queue lands
853
+ if (self._state.status !== 'active') {
854
+ return;
855
+ }
856
+ self.send({
857
+ type: rejectEventType,
858
+ data: errorData
859
+ });
860
+ });
865
861
  },
866
862
  getInitialState: (_, input) => {
867
863
  return {
868
- canceled: false,
869
- receivers: new Set(),
870
- dispose: undefined,
864
+ status: 'active',
865
+ data: undefined,
871
866
  input
872
867
  };
873
868
  },
874
- getSnapshot: () => undefined,
875
- getPersistedState: ({
876
- input
877
- }) => input
869
+ getSnapshot: state => state.data,
870
+ getStatus: state => state,
871
+ getPersistedState: state => state,
872
+ restoreState: state => state
878
873
  };
879
874
  return logic;
880
875
  }
@@ -913,6 +908,7 @@ function toActorRef(actorRefLike) {
913
908
  id: 'anonymous',
914
909
  sessionId: '',
915
910
  getSnapshot: () => undefined,
911
+ // TODO: this isn't safe
916
912
  [symbolObservable]: function () {
917
913
  return this;
918
914
  },
@@ -2772,7 +2768,7 @@ function createSpawner(actorContext, {
2772
2768
  }
2773
2769
  };
2774
2770
  return (src, options) => {
2775
- const actorRef = spawn(src, options);
2771
+ const actorRef = spawn(src, options); // TODO: fix types
2776
2772
  spawnedChildren[actorRef.id] = actorRef;
2777
2773
  actorContext.defer(() => {
2778
2774
  if (actorRef.status === ActorStatus.Stopped) {