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,4 +1,5 @@
import type { Dispatch } from "@commands/dispatcher";
import type { CommandId, CommandPayloads } from "@commands/payloads";
export type Keybind = string;
@@ -13,9 +14,9 @@ export type KeybindEvent = {
export type GlobalKeybindConsumer = (event: KeybindEvent) => boolean;
export type CommandKeybind = {
commandId: string;
payload?: unknown;
export type CommandKeybind<TCommandId extends CommandId = CommandId> = {
commandId: TCommandId;
payload: CommandPayloads[TCommandId];
};
export type KeybindMap = ReadonlyMap<Keybind, CommandKeybind>;