mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 09:01:20 +00:00
feat: add type-safe KeyId for matchesKey function
- Add KeyId union type covering all valid key combinations
- Add Key helper object for autocomplete (Key.ctrl('c'), Key.escape, etc.)
- Update matchesKey signature to use KeyId instead of string
- Catches typos like 'esacpe' at compile time
This commit is contained in:
parent
f79256ac3b
commit
38b7f21e01
3 changed files with 123 additions and 9 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { matchesKey } from "./keys.js";
|
||||
import { type KeyId, matchesKey } from "./keys.js";
|
||||
|
||||
/**
|
||||
* Editor actions that can be bound to keys.
|
||||
|
|
@ -31,10 +31,8 @@ export type EditorAction =
|
|||
// Clipboard
|
||||
| "copy";
|
||||
|
||||
/**
|
||||
* Key identifier string (e.g., "ctrl+c", "shift+ctrl+p", "escape").
|
||||
*/
|
||||
export type KeyId = string;
|
||||
// Re-export KeyId from keys.ts
|
||||
export type { KeyId };
|
||||
|
||||
/**
|
||||
* Editor keybindings configuration.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue