fix(types): close 6 svelte-check errors — keybindings test Input cast (#214 Group E)#236
Merged
Merged
Conversation
…#214 Group E) Part of the #214 cleanup. Brings `npm run check` from 53 -> 47 errors (closes 6). Test-only change, no production behavior. ## What was wrong `keybindingsLibrary.test.ts` mocks `$lib/types` (lines 4-21) to provide a minimal universe with an extra `'Input'` context and a `'newline'` action — that's how the conflict-detection tests have something cross-context to exercise (e.g. `detectConflicts('Global', 'Shift+Enter')` expects an `Input` conflict, where `newline` defaults to `Shift+Enter`). `vi.mock` is runtime-only, so TypeScript still reads the real `KeybindingContext` union from `$lib/types`, which doesn't include `'Input'`. The store methods are typed `(context: KeybindingContext, ...)` so the 6 test sites passing `'Input'` errored. ## Fix Imported `KeybindingContext` and added one cast alias at the top of the file: const Input = 'Input' as unknown as KeybindingContext; Replaced the 6 `'Input'` literals at call sites typed against `KeybindingContext` (setBinding, detectConflicts, Map.has, binding.context comparison). Comment explains why the cast is needed so future readers don't try to delete it. NOT adding `'Input'` to the production `KeybindingContext` union — that would be a phantom value (nothing in real `KEYBINDING_CONTEXTS` or `KEYBINDING_ACTIONS` uses it; it only exists in this test's mock). Same principle as #221's spinnerverbs decision. ## Test plan - [x] `npm run check` — 47 errors (down from 53 on `main`) - [x] `npx vitest run keybindingsLibrary` — 31/31 pass Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tylergraydev
added a commit
that referenced
this pull request
May 16, 2026
Rebased onto current main. The original commit also included fixes for preexisting type errors across usageStore/skill/invokeMock/etc., but main has since landed canonical fixes for all of them (#221, #226, #227, #236), so those parts of the original commit are dropped. Net change: WSL2-specific Rust code (utils/wsl.rs, services/wsl_config.rs) plus the settings/config plumbing to expose WSL editors in the UI. See PR #149 for full description.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the #214 cleanup. Brings
npm run checkfrom 53 → 47 errors (closes 6). Test-only change, no production behavior.What was wrong
keybindingsLibrary.test.tsmocks$lib/types(lines 4–21) to provide a minimal universe with an extra'Input'context and a'newline'action — that's how the conflict-detection tests have something cross-context to exercise (e.g.detectConflicts('Global', 'Shift+Enter')expects anInputconflict, wherenewlinedefaults toShift+Enter).vi.mockis runtime-only, so TypeScript still reads the realKeybindingContextunion from$lib/types, which doesn't include'Input'. The store methods are typed(context: KeybindingContext, …)so the 6 test sites passing'Input'errored.Fix
Imported
KeybindingContextand added one cast alias at the top of the file:Replaced the 6
'Input'literals at the call sites typed againstKeybindingContext(setBinding,detectConflicts,Map.has,binding.contextcomparison). A comment explains why the cast is needed so future readers don't try to delete it.Decision: don't add
'Input'to the production unionThat would be a phantom value — nothing in the real
KEYBINDING_CONTEXTSorKEYBINDING_ACTIONSuses it; it only exists in this test's mock. Same principle as #221's spinnerverbs decision: don't make production types lie to accommodate a test.Test plan
npm run check— 47 errors (down from 53 onmain)npx vitest run keybindingsLibrary— 31/31 pass🤖 Generated with Claude Code