xstate 5.18.1 → 5.19.0

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 (71) hide show
  1. package/actions/dist/xstate-actions.cjs.d.mts +1 -1
  2. package/actions/dist/xstate-actions.cjs.d.ts +1 -1
  3. package/actions/dist/xstate-actions.cjs.js +2 -2
  4. package/actions/dist/xstate-actions.development.cjs.js +2 -2
  5. package/actions/dist/xstate-actions.development.esm.js +2 -2
  6. package/actions/dist/xstate-actions.esm.js +2 -2
  7. package/actions/dist/xstate-actions.umd.min.js +1 -1
  8. package/actions/dist/xstate-actions.umd.min.js.map +1 -1
  9. package/actors/dist/xstate-actors.cjs.d.mts +1 -1
  10. package/actors/dist/xstate-actors.cjs.d.ts +1 -1
  11. package/actors/dist/xstate-actors.cjs.js +1 -1
  12. package/actors/dist/xstate-actors.development.cjs.js +1 -1
  13. package/actors/dist/xstate-actors.development.esm.js +1 -1
  14. package/actors/dist/xstate-actors.esm.js +1 -1
  15. package/actors/dist/xstate-actors.umd.min.js +1 -1
  16. package/actors/dist/xstate-actors.umd.min.js.map +1 -1
  17. package/dev/dist/xstate-dev.cjs.d.mts +1 -1
  18. package/dev/dist/xstate-dev.cjs.d.ts +1 -1
  19. package/dev/dist/xstate-dev.cjs.js +1 -1
  20. package/dev/dist/xstate-dev.development.cjs.js +1 -1
  21. package/dev/dist/xstate-dev.development.esm.js +1 -1
  22. package/dev/dist/xstate-dev.esm.js +1 -1
  23. package/dev/dist/xstate-dev.umd.min.js.map +1 -1
  24. package/dist/declarations/src/State.d.ts +1 -1
  25. package/dist/declarations/src/actions/raise.d.ts +9 -1
  26. package/dist/declarations/src/actions/send.d.ts +10 -1
  27. package/dist/declarations/src/createActor.d.ts +2 -1
  28. package/dist/declarations/src/getNextSnapshot.d.ts +2 -0
  29. package/dist/declarations/src/index.d.ts +1 -0
  30. package/dist/declarations/src/inspection.d.ts +3 -3
  31. package/dist/declarations/src/stateUtils.d.ts +17 -7
  32. package/dist/declarations/src/transition.d.ts +16 -0
  33. package/dist/declarations/src/types.d.ts +47 -14
  34. package/dist/declarations/src/utils.d.ts +1 -1
  35. package/dist/{log-d26be77d.development.cjs.js → log-17337367.development.cjs.js} +29 -19
  36. package/dist/{log-a2c94240.esm.js → log-2a773d37.esm.js} +28 -15
  37. package/dist/{log-098d2ed5.cjs.js → log-b0ee96de.cjs.js} +28 -15
  38. package/dist/{log-c92a07bc.development.esm.js → log-ef30c65f.development.esm.js} +29 -19
  39. package/dist/{raise-206d3d29.development.esm.js → raise-1db27a82.development.esm.js} +98 -73
  40. package/dist/{raise-830a98f7.development.cjs.js → raise-4acdb210.development.cjs.js} +98 -73
  41. package/dist/{raise-cde45f56.cjs.js → raise-60cebf03.cjs.js} +94 -71
  42. package/dist/{raise-c0e3c984.esm.js → raise-c17ec2bc.esm.js} +94 -71
  43. package/dist/xstate.cjs.d.mts +1 -1
  44. package/dist/xstate.cjs.d.ts +1 -1
  45. package/dist/xstate.cjs.js +60 -16
  46. package/dist/xstate.cjs.mjs +2 -0
  47. package/dist/xstate.development.cjs.js +60 -16
  48. package/dist/xstate.development.cjs.mjs +2 -0
  49. package/dist/xstate.development.esm.js +61 -19
  50. package/dist/xstate.esm.js +61 -19
  51. package/dist/xstate.umd.min.js +1 -1
  52. package/dist/xstate.umd.min.js.map +1 -1
  53. package/guards/dist/xstate-guards.cjs.d.mts +1 -1
  54. package/guards/dist/xstate-guards.cjs.d.ts +1 -1
  55. package/guards/dist/xstate-guards.cjs.js +1 -1
  56. package/guards/dist/xstate-guards.development.cjs.js +1 -1
  57. package/guards/dist/xstate-guards.development.esm.js +1 -1
  58. package/guards/dist/xstate-guards.esm.js +1 -1
  59. package/guards/dist/xstate-guards.umd.min.js +1 -1
  60. package/guards/dist/xstate-guards.umd.min.js.map +1 -1
  61. package/package.json +7 -7
  62. package/actions/dist/xstate-actions.cjs.d.mts.map +0 -1
  63. package/actions/dist/xstate-actions.cjs.d.ts.map +0 -1
  64. package/actors/dist/xstate-actors.cjs.d.mts.map +0 -1
  65. package/actors/dist/xstate-actors.cjs.d.ts.map +0 -1
  66. package/dev/dist/xstate-dev.cjs.d.mts.map +0 -1
  67. package/dev/dist/xstate-dev.cjs.d.ts.map +0 -1
  68. package/dist/xstate.cjs.d.mts.map +0 -1
  69. package/dist/xstate.cjs.d.ts.map +0 -1
  70. package/guards/dist/xstate-guards.cjs.d.mts.map +0 -1
  71. package/guards/dist/xstate-guards.cjs.d.ts.map +0 -1
@@ -154,7 +154,7 @@ function toStatePath(stateId) {
154
154
  if (isArray(stateId)) {
155
155
  return stateId;
156
156
  }
157
- let result = [];
157
+ const result = [];
158
158
  let segment = '';
159
159
  for (let i = 0; i < stateId.length; i++) {
160
160
  const char = stateId.charCodeAt(i);
@@ -234,7 +234,7 @@ function resolveOutput(mapper, context, event, self) {
234
234
  });
235
235
  }
236
236
  if (!!mapper && typeof mapper === 'object' && Object.values(mapper).some(val => typeof val === 'function')) {
237
- console.warn(`Dynamically mapping values to individual properties is deprecated. Use a single function that returns the mapped object instead.\nFound object containing properties whose values are possibly mapping functions: ${Object.entries(mapper).filter(([key, value]) => typeof value === 'function').map(([key, value]) => `\n - ${key}: ${value.toString().replace(/\n\s*/g, '')}`).join('')}`);
237
+ console.warn(`Dynamically mapping values to individual properties is deprecated. Use a single function that returns the mapped object instead.\nFound object containing properties whose values are possibly mapping functions: ${Object.entries(mapper).filter(([, value]) => typeof value === 'function').map(([key, value]) => `\n - ${key}: ${value.toString().replace(/\n\s*/g, '')}`).join('')}`);
238
238
  }
239
239
  return mapper;
240
240
  }
@@ -422,6 +422,7 @@ function createSystem(rootActor, options) {
422
422
  return system;
423
423
  }
424
424
 
425
+ let executingCustomAction = false;
425
426
  const $$ACTOR_TYPE = 1;
426
427
 
427
428
  // those values are currently used by @xstate/react directly so it's important to keep the assigned values in sync
@@ -542,10 +543,37 @@ class Actor {
542
543
  if (!listeners && !wildcardListener) {
543
544
  return;
544
545
  }
545
- const allListeners = new Set([...(listeners ? listeners.values() : []), ...(wildcardListener ? wildcardListener.values() : [])]);
546
- for (const handler of Array.from(allListeners)) {
546
+ const allListeners = [...(listeners ? listeners.values() : []), ...(wildcardListener ? wildcardListener.values() : [])];
547
+ for (const handler of allListeners) {
547
548
  handler(emittedEvent);
548
549
  }
550
+ },
551
+ actionExecutor: action => {
552
+ const exec = () => {
553
+ this._actorScope.system._sendInspectionEvent({
554
+ type: '@xstate.action',
555
+ actorRef: this,
556
+ action: {
557
+ type: action.type,
558
+ params: action.params
559
+ }
560
+ });
561
+ if (!action.exec) {
562
+ return;
563
+ }
564
+ const saveExecutingCustomAction = executingCustomAction;
565
+ try {
566
+ executingCustomAction = true;
567
+ action.exec(action.info, action.params);
568
+ } finally {
569
+ executingCustomAction = saveExecutingCustomAction;
570
+ }
571
+ };
572
+ if (this._processingStatus === ProcessingStatus.Running) {
573
+ exec();
574
+ } else {
575
+ this._deferred.push(exec);
576
+ }
549
577
  }
550
578
  };
551
579
 
@@ -1085,11 +1113,13 @@ function resolveCancel(_, snapshot, actionArgs, actionParams, {
1085
1113
  sendId
1086
1114
  }) {
1087
1115
  const resolvedSendId = typeof sendId === 'function' ? sendId(actionArgs, actionParams) : sendId;
1088
- return [snapshot, resolvedSendId];
1116
+ return [snapshot, {
1117
+ sendId: resolvedSendId
1118
+ }, undefined];
1089
1119
  }
1090
- function executeCancel(actorScope, resolvedSendId) {
1120
+ function executeCancel(actorScope, params) {
1091
1121
  actorScope.defer(() => {
1092
- actorScope.system.scheduler.cancel(actorScope.self, resolvedSendId);
1122
+ actorScope.system.scheduler.cancel(actorScope.self, params.sendId);
1093
1123
  });
1094
1124
  }
1095
1125
  /**
@@ -1125,7 +1155,7 @@ function executeCancel(actorScope, resolvedSendId) {
1125
1155
  * @param sendId The `id` of the `sendTo(...)` action to cancel.
1126
1156
  */
1127
1157
  function cancel(sendId) {
1128
- function cancel(args, params) {
1158
+ function cancel(_args, _params) {
1129
1159
  {
1130
1160
  throw new Error(`This isn't supposed to be called`);
1131
1161
  }
@@ -1147,22 +1177,26 @@ function resolveSpawn(actorScope, snapshot, actionArgs, _actionParams, {
1147
1177
  const logic = typeof src === 'string' ? resolveReferencedActor(snapshot.machine, src) : src;
1148
1178
  const resolvedId = typeof id === 'function' ? id(actionArgs) : id;
1149
1179
  let actorRef;
1180
+ let resolvedInput = undefined;
1150
1181
  if (logic) {
1182
+ resolvedInput = typeof input === 'function' ? input({
1183
+ context: snapshot.context,
1184
+ event: actionArgs.event,
1185
+ self: actorScope.self
1186
+ }) : input;
1151
1187
  actorRef = createActor(logic, {
1152
1188
  id: resolvedId,
1153
1189
  src,
1154
1190
  parent: actorScope.self,
1155
1191
  syncSnapshot,
1156
1192
  systemId,
1157
- input: typeof input === 'function' ? input({
1158
- context: snapshot.context,
1159
- event: actionArgs.event,
1160
- self: actorScope.self
1161
- }) : input
1193
+ input: resolvedInput
1162
1194
  });
1163
1195
  }
1164
1196
  if (!actorRef) {
1165
- console.warn(`Actor type '${src}' not found in machine '${actorScope.id}'.`);
1197
+ console.warn(
1198
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions,@typescript-eslint/no-base-to-string
1199
+ `Actor type '${src}' not found in machine '${actorScope.id}'.`);
1166
1200
  }
1167
1201
  return [cloneMachineSnapshot(snapshot, {
1168
1202
  children: {
@@ -1171,11 +1205,13 @@ function resolveSpawn(actorScope, snapshot, actionArgs, _actionParams, {
1171
1205
  }
1172
1206
  }), {
1173
1207
  id,
1174
- actorRef
1175
- }];
1208
+ systemId,
1209
+ actorRef,
1210
+ src,
1211
+ input: resolvedInput
1212
+ }, undefined];
1176
1213
  }
1177
1214
  function executeSpawn(actorScope, {
1178
- id,
1179
1215
  actorRef
1180
1216
  }) {
1181
1217
  if (!actorRef) {
@@ -1194,12 +1230,12 @@ function spawnChild(...[src, {
1194
1230
  input,
1195
1231
  syncSnapshot = false
1196
1232
  } = {}]) {
1197
- function spawnChild(args, params) {
1233
+ function spawnChild(_args, _params) {
1198
1234
  {
1199
1235
  throw new Error(`This isn't supposed to be called`);
1200
1236
  }
1201
1237
  }
1202
- spawnChild.type = 'snapshot.spawnChild';
1238
+ spawnChild.type = 'xstate.spawnChild';
1203
1239
  spawnChild.id = id;
1204
1240
  spawnChild.systemId = systemId;
1205
1241
  spawnChild.src = src;
@@ -1224,7 +1260,7 @@ function resolveStop(_, snapshot, args, actionParams, {
1224
1260
  }
1225
1261
  return [cloneMachineSnapshot(snapshot, {
1226
1262
  children
1227
- }), resolvedActorRef];
1263
+ }), resolvedActorRef, undefined];
1228
1264
  }
1229
1265
  function executeStop(actorScope, actorRef) {
1230
1266
  if (!actorRef) {
@@ -1256,7 +1292,7 @@ function executeStop(actorScope, actorRef) {
1256
1292
  * @param actorRef The actor to stop.
1257
1293
  */
1258
1294
  function stopChild(actorRef) {
1259
- function stop(args, params) {
1295
+ function stop(_args, _params) {
1260
1296
  {
1261
1297
  throw new Error(`This isn't supposed to be called`);
1262
1298
  }
@@ -1286,7 +1322,7 @@ function checkStateIn(snapshot, _, {
1286
1322
  return snapshot.matches(stateValue);
1287
1323
  }
1288
1324
  function stateIn(stateValue) {
1289
- function stateIn(args, params) {
1325
+ function stateIn() {
1290
1326
  {
1291
1327
  throw new Error(`This isn't supposed to be called`);
1292
1328
  }
@@ -1334,7 +1370,7 @@ function checkNot(snapshot, {
1334
1370
  * @returns A guard
1335
1371
  */
1336
1372
  function not(guard) {
1337
- function not(args, params) {
1373
+ function not(_args, _params) {
1338
1374
  {
1339
1375
  throw new Error(`This isn't supposed to be called`);
1340
1376
  }
@@ -1382,7 +1418,7 @@ function checkAnd(snapshot, {
1382
1418
  * @returns A guard action object
1383
1419
  */
1384
1420
  function and(guards) {
1385
- function and(args, params) {
1421
+ function and(_args, _params) {
1386
1422
  {
1387
1423
  throw new Error(`This isn't supposed to be called`);
1388
1424
  }
@@ -1430,7 +1466,7 @@ function checkOr(snapshot, {
1430
1466
  * @returns A guard action object
1431
1467
  */
1432
1468
  function or(guards) {
1433
- function or(args, params) {
1469
+ function or(_args, _params) {
1434
1470
  {
1435
1471
  throw new Error(`This isn't supposed to be called`);
1436
1472
  }
@@ -1531,7 +1567,6 @@ function getValueFromAdj(baseNode, adjList) {
1531
1567
  if (!childStateNodes) {
1532
1568
  return {}; // todo: fix?
1533
1569
  }
1534
-
1535
1570
  if (baseNode.type === 'compound') {
1536
1571
  const childStateNode = childStateNodes[0];
1537
1572
  if (childStateNode) {
@@ -1617,7 +1652,7 @@ function getDelayedTransitions(stateNode) {
1617
1652
  if (!afterConfig) {
1618
1653
  return [];
1619
1654
  }
1620
- const mutateEntryExit = (delay, i) => {
1655
+ const mutateEntryExit = delay => {
1621
1656
  const afterEvent = createAfterEvent(delay, stateNode.id);
1622
1657
  const eventType = afterEvent.type;
1623
1658
  stateNode.entry.push(raise(afterEvent, {
@@ -1627,7 +1662,7 @@ function getDelayedTransitions(stateNode) {
1627
1662
  stateNode.exit.push(cancel(eventType));
1628
1663
  return eventType;
1629
1664
  };
1630
- const delayedTransitions = Object.keys(afterConfig).flatMap((delay, i) => {
1665
+ const delayedTransitions = Object.keys(afterConfig).flatMap(delay => {
1631
1666
  const configTransition = afterConfig[delay];
1632
1667
  const resolvedTransition = typeof configTransition === 'string' ? {
1633
1668
  target: configTransition
@@ -1717,7 +1752,9 @@ function formatTransitions(stateNode) {
1717
1752
  function formatInitialTransition(stateNode, _target) {
1718
1753
  const resolvedTarget = typeof _target === 'string' ? stateNode.states[_target] : _target ? stateNode.states[_target.target] : undefined;
1719
1754
  if (!resolvedTarget && _target) {
1720
- throw new Error(`Initial state node "${_target}" not found on parent state node #${stateNode.id}`);
1755
+ throw new Error(
1756
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-base-to-string
1757
+ `Initial state node "${_target}" not found on parent state node #${stateNode.id}`);
1721
1758
  }
1722
1759
  const transition = {
1723
1760
  source: stateNode,
@@ -1827,7 +1864,7 @@ function getStateNodeByPath(stateNode, statePath) {
1827
1864
  if (typeof statePath === 'string' && isStateId(statePath)) {
1828
1865
  try {
1829
1866
  return stateNode.machine.getStateNodeById(statePath);
1830
- } catch (e) {
1867
+ } catch {
1831
1868
  // try individual paths
1832
1869
  // throw e;
1833
1870
  }
@@ -2056,18 +2093,20 @@ function microstep(transitions, currentSnapshot, actorScope, event, isInitial, i
2056
2093
 
2057
2094
  // Exit states
2058
2095
  if (!isInitial) {
2059
- [nextState, historyValue] = exitStates(nextState, event, actorScope, filteredTransitions, mutStateNodeSet, historyValue, internalQueue);
2096
+ [nextState, historyValue] = exitStates(nextState, event, actorScope, filteredTransitions, mutStateNodeSet, historyValue, internalQueue, actorScope.actionExecutor);
2060
2097
  }
2061
2098
 
2062
2099
  // Execute transition content
2063
- nextState = resolveActionsAndContext(nextState, event, actorScope, filteredTransitions.flatMap(t => t.actions), internalQueue);
2100
+ nextState = resolveActionsAndContext(nextState, event, actorScope, filteredTransitions.flatMap(t => t.actions), internalQueue, undefined);
2064
2101
 
2065
2102
  // Enter states
2066
2103
  nextState = enterStates(nextState, event, actorScope, filteredTransitions, mutStateNodeSet, internalQueue, historyValue, isInitial);
2067
2104
  const nextStateNodes = [...mutStateNodeSet];
2068
2105
  if (nextState.status === 'done') {
2069
- nextState = resolveActionsAndContext(nextState, event, actorScope, nextStateNodes.sort((a, b) => b.order - a.order).flatMap(state => state.exit), internalQueue);
2106
+ nextState = resolveActionsAndContext(nextState, event, actorScope, nextStateNodes.sort((a, b) => b.order - a.order).flatMap(state => state.exit), internalQueue, undefined);
2070
2107
  }
2108
+
2109
+ // eslint-disable-next-line no-useless-catch
2071
2110
  try {
2072
2111
  if (historyValue === currentSnapshot.historyValue && areStateNodeCollectionsEqual(currentSnapshot._nodes, mutStateNodeSet)) {
2073
2112
  return nextState;
@@ -2237,7 +2276,7 @@ function addAncestorStatesToEnter(statesToEnter, historyValue, statesForDefaultE
2237
2276
  function addProperAncestorStatesToEnter(stateNode, toStateNode, statesToEnter, historyValue, statesForDefaultEntry) {
2238
2277
  addAncestorStatesToEnter(statesToEnter, historyValue, statesForDefaultEntry, getProperAncestors(stateNode, toStateNode));
2239
2278
  }
2240
- function exitStates(currentSnapshot, event, actorScope, transitions, mutStateNodeSet, historyValue, internalQueue) {
2279
+ function exitStates(currentSnapshot, event, actorScope, transitions, mutStateNodeSet, historyValue, internalQueue, _actionExecutor) {
2241
2280
  let nextSnapshot = currentSnapshot;
2242
2281
  const statesToExit = computeExitSet(transitions, mutStateNodeSet, historyValue);
2243
2282
  statesToExit.sort((a, b) => b.order - a.order);
@@ -2261,12 +2300,14 @@ function exitStates(currentSnapshot, event, actorScope, transitions, mutStateNod
2261
2300
  }
2262
2301
  }
2263
2302
  for (const s of statesToExit) {
2264
- nextSnapshot = resolveActionsAndContext(nextSnapshot, event, actorScope, [...s.exit, ...s.invoke.map(def => stopChild(def.id))], internalQueue);
2303
+ nextSnapshot = resolveActionsAndContext(nextSnapshot, event, actorScope, [...s.exit, ...s.invoke.map(def => stopChild(def.id))], internalQueue, undefined);
2265
2304
  mutStateNodeSet.delete(s);
2266
2305
  }
2267
2306
  return [nextSnapshot, changedHistory || historyValue];
2268
2307
  }
2269
- let executingCustomAction = false;
2308
+ function getAction(machine, actionType) {
2309
+ return machine.implementations.actions[actionType];
2310
+ }
2270
2311
  function resolveAndExecuteActionsWithContext(currentSnapshot, event, actorScope, actions, extra, retries) {
2271
2312
  const {
2272
2313
  machine
@@ -2278,10 +2319,8 @@ function resolveAndExecuteActionsWithContext(currentSnapshot, event, actorScope,
2278
2319
  // the existing type of `.actions` assumes non-nullable `TExpressionAction`
2279
2320
  // it's fine to cast this here to get a common type and lack of errors in the rest of the code
2280
2321
  // our logic below makes sure that we call those 2 "variants" correctly
2281
- machine.implementations.actions[typeof action === 'string' ? action : action.type];
2282
- if (!resolvedAction) {
2283
- continue;
2284
- }
2322
+
2323
+ getAction(machine, typeof action === 'string' ? action : action.type);
2285
2324
  const actionArgs = {
2286
2325
  context: intermediateSnapshot.context,
2287
2326
  event,
@@ -2292,30 +2331,13 @@ function resolveAndExecuteActionsWithContext(currentSnapshot, event, actorScope,
2292
2331
  context: intermediateSnapshot.context,
2293
2332
  event
2294
2333
  }) : action.params : undefined;
2295
- function executeAction() {
2296
- actorScope.system._sendInspectionEvent({
2297
- type: '@xstate.action',
2298
- actorRef: actorScope.self,
2299
- action: {
2300
- type: typeof action === 'string' ? action : typeof action === 'object' ? action.type : action.name || '(anonymous)',
2301
- params: actionParams
2302
- }
2334
+ if (!resolvedAction || !('resolve' in resolvedAction)) {
2335
+ actorScope.actionExecutor({
2336
+ type: typeof action === 'string' ? action : typeof action === 'object' ? action.type : action.name || '(anonymous)',
2337
+ info: actionArgs,
2338
+ params: actionParams,
2339
+ exec: resolvedAction
2303
2340
  });
2304
- try {
2305
- executingCustomAction = resolvedAction;
2306
- resolvedAction(actionArgs, actionParams);
2307
- } finally {
2308
- executingCustomAction = false;
2309
- }
2310
- }
2311
- if (!('resolve' in resolvedAction)) {
2312
- if (actorScope.self._processingStatus === ProcessingStatus.Running) {
2313
- executeAction();
2314
- } else {
2315
- actorScope.defer(() => {
2316
- executeAction();
2317
- });
2318
- }
2319
2341
  continue;
2320
2342
  }
2321
2343
  const builtinAction = resolvedAction;
@@ -2327,11 +2349,12 @@ function resolveAndExecuteActionsWithContext(currentSnapshot, event, actorScope,
2327
2349
  retries?.push([builtinAction, params]);
2328
2350
  }
2329
2351
  if ('execute' in builtinAction) {
2330
- if (actorScope.self._processingStatus === ProcessingStatus.Running) {
2331
- builtinAction.execute(actorScope, params);
2332
- } else {
2333
- actorScope.defer(builtinAction.execute.bind(null, actorScope, params));
2334
- }
2352
+ actorScope.actionExecutor({
2353
+ type: builtinAction.type,
2354
+ info: actionArgs,
2355
+ params,
2356
+ exec: builtinAction.execute.bind(null, actorScope, params)
2357
+ });
2335
2358
  }
2336
2359
  if (actions) {
2337
2360
  intermediateSnapshot = resolveAndExecuteActionsWithContext(intermediateSnapshot, event, actorScope, actions, extra, retries);
@@ -2350,7 +2373,7 @@ function resolveActionsAndContext(currentSnapshot, event, actorScope, actions, i
2350
2373
  });
2351
2374
  return nextState;
2352
2375
  }
2353
- function macrostep(snapshot, event, actorScope, internalQueue = []) {
2376
+ function macrostep(snapshot, event, actorScope, internalQueue) {
2354
2377
  if (event.type === WILDCARD) {
2355
2378
  throw new Error(`An event cannot have the wildcard type ('${WILDCARD}')`);
2356
2379
  }
@@ -2432,7 +2455,7 @@ function macrostep(snapshot, event, actorScope, internalQueue = []) {
2432
2455
  };
2433
2456
  }
2434
2457
  function stopChildren(nextState, event, actorScope) {
2435
- return resolveActionsAndContext(nextState, event, actorScope, Object.values(nextState.children).map(child => stopChild(child)), []);
2458
+ return resolveActionsAndContext(nextState, event, actorScope, Object.values(nextState.children).map(child => stopChild(child)), [], undefined);
2436
2459
  }
2437
2460
  function selectTransitions(event, nextState) {
2438
2461
  return nextState.machine.getTransitionData(nextState, event);
@@ -2605,7 +2628,9 @@ function resolveRaise(_, snapshot, args, actionParams, {
2605
2628
  }) {
2606
2629
  const delaysMap = snapshot.machine.implementations.delays;
2607
2630
  if (typeof eventOrExpr === 'string') {
2608
- throw new Error(`Only event objects may be used with raise; use raise({ type: "${eventOrExpr}" }) instead`);
2631
+ throw new Error(
2632
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
2633
+ `Only event objects may be used with raise; use raise({ type: "${eventOrExpr}" }) instead`);
2609
2634
  }
2610
2635
  const resolvedEvent = typeof eventOrExpr === 'function' ? eventOrExpr(args, actionParams) : eventOrExpr;
2611
2636
  let resolvedDelay;
@@ -2622,7 +2647,7 @@ function resolveRaise(_, snapshot, args, actionParams, {
2622
2647
  event: resolvedEvent,
2623
2648
  id,
2624
2649
  delay: resolvedDelay
2625
- }];
2650
+ }, undefined];
2626
2651
  }
2627
2652
  function executeRaise(actorScope, params) {
2628
2653
  const {
@@ -2648,7 +2673,7 @@ function raise(eventOrExpr, options) {
2648
2673
  if (executingCustomAction) {
2649
2674
  console.warn('Custom actions should not call `raise()` directly, as it is not imperative. See https://stately.ai/docs/actions#built-in-actions for more details.');
2650
2675
  }
2651
- function raise(args, params) {
2676
+ function raise(_args, _params) {
2652
2677
  {
2653
2678
  throw new Error(`This isn't supposed to be called`);
2654
2679
  }