feat(commands): type command payload dispatch

This commit is contained in:
syntaxbullet
2026-07-03 09:50:39 +02:00
parent af71a49b09
commit d77bdc22a9
5 changed files with 24 additions and 5 deletions

View File

@@ -1,8 +1,9 @@
import type { AppState } from "@editor/state";
import type { CommandContext } from "./command";
import type { CommandId, CommandPayloads } from "./payloads";
import type { CommandRegistry } from "./registry";
export type Dispatch = <TPayload>(commandId: string, payload: TPayload) => AppState;
export type Dispatch = <TCommandId extends CommandId>(commandId: TCommandId, payload: CommandPayloads[TCommandId]) => AppState;
export type CommandDispatcher = {
dispatch: Dispatch;