mirror of
https://github.com/robonen/tools.git
synced 2026-03-20 10:54:44 +00:00
chore(core/stdlib): fix lint
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import type { MaybePromise } from '../../../types';
|
||||
|
||||
export type Command = {
|
||||
export interface Command {
|
||||
execute: () => void;
|
||||
undo: () => void;
|
||||
};
|
||||
}
|
||||
|
||||
export type AsyncCommand = {
|
||||
export interface AsyncCommand {
|
||||
execute: () => MaybePromise<void>;
|
||||
undo: () => MaybePromise<void>;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
export class BaseStateMachine<
|
||||
States extends string,
|
||||
Events extends string,
|
||||
_Events extends string,
|
||||
Context,
|
||||
NodeConfig,
|
||||
> {
|
||||
|
||||
@@ -7,18 +7,18 @@ import type { MaybePromise } from '../../../types';
|
||||
* @template Guard - Guard return type (boolean or MaybePromise\<boolean\>)
|
||||
* @template Action - Action return type (void or MaybePromise\<void\>)
|
||||
*/
|
||||
export type TransitionConfig<
|
||||
export interface TransitionConfig<
|
||||
Context,
|
||||
Guard = boolean,
|
||||
Action = void,
|
||||
> = {
|
||||
> {
|
||||
/** Target state to transition to */
|
||||
target: string;
|
||||
/** Guard condition — transition only occurs if this returns true */
|
||||
guard?: (context: Context) => Guard;
|
||||
/** Side effect executed during transition (before entering target state) */
|
||||
action?: (context: Context) => Action;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A transition can be a target state name or a detailed configuration
|
||||
@@ -36,18 +36,18 @@ export type Transition<
|
||||
* @template Guard - Guard return type
|
||||
* @template Hook - Hook return type (entry/exit/action)
|
||||
*/
|
||||
export type StateNodeConfig<
|
||||
export interface StateNodeConfig<
|
||||
Context,
|
||||
Guard = boolean,
|
||||
Hook = void,
|
||||
> = {
|
||||
> {
|
||||
/** Map of event names to transitions */
|
||||
on?: Record<string, Transition<Context, Guard, Hook>>;
|
||||
/** Hook called when entering this state */
|
||||
entry?: (context: Context) => Hook;
|
||||
/** Hook called when exiting this state */
|
||||
exit?: (context: Context) => Hook;
|
||||
};
|
||||
}
|
||||
|
||||
/** Sync state node config — guards return boolean, hooks return void */
|
||||
export type SyncStateNodeConfig<Context> = StateNodeConfig<Context, boolean, void>;
|
||||
|
||||
Reference in New Issue
Block a user