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