feat(commands): type command payload dispatch
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user