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