From 50efffa34a2ea5a3515561d7425da0c109631f36 Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Sat, 18 Mar 2023 16:16:36 +0330 Subject: [PATCH] fix(fsm): action maybe async --- core/fsm/src/core.ts | 4 ++-- core/fsm/src/type.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/fsm/src/core.ts b/core/fsm/src/core.ts index 44331c059..d8418942b 100644 --- a/core/fsm/src/core.ts +++ b/core/fsm/src/core.ts @@ -12,7 +12,7 @@ import type { FsmTypeHelper, SignalConfig, } from './type.js'; -import type {OmitFirstParam, SingleOrArray, StringifyableRecord} from '@alwatr/type'; +import type {MaybePromise, OmitFirstParam, SingleOrArray, StringifyableRecord} from '@alwatr/type'; globalAlwatr.registeredList.push({ name: '@alwatr/fsm', @@ -199,7 +199,7 @@ export const _execAction = ( constructor: FsmConstructor, actionNames: SingleOrArray | undefined, finiteStateMachine: FsmConsumerInterface, -): boolean | void => { +): boolean | MaybePromise => { if (actionNames == null) return; logger.logMethodArgs('execAction', {constructorId: constructor.id, actionNames}); diff --git a/core/fsm/src/type.ts b/core/fsm/src/type.ts index d6b7b17e4..4270f8751 100644 --- a/core/fsm/src/type.ts +++ b/core/fsm/src/type.ts @@ -1,6 +1,6 @@ import type {finiteStateMachineConsumer} from './core.js'; import type {DebounceType} from '@alwatr/signal'; -import type {ArrayItems, SingleOrArray, StringifyableRecord} from '@alwatr/type'; +import type {ArrayItems, MaybePromise, SingleOrArray, StringifyableRecord} from '@alwatr/type'; export interface FsmConstructor { /** @@ -107,7 +107,7 @@ export interface FsmInstance< } export type ActionRecord = { - readonly [P in T['TActionName']]?: (finiteStateMachine: FsmConsumerInterface) => void | boolean; + readonly [P in T['TActionName']]?: (finiteStateMachine: FsmConsumerInterface) => MaybePromise | boolean; }; export type SignalConfig = {