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