opencode
opencode copied to clipboard
fix(tui): add KeyEvent type annotation to useKeyboard callback
Summary
- Add explicit
KeyEventtype import from@opentui/core - Annotate
useKeyboardcallback parameter withKeyEventtype to fix TypeScript error
Problem
The useKeyboard callback in dialog.tsx uses evt.stopPropagation(), but TypeScript reports:
TS2339: Property 'stopPropagation' does not exist on type 'KeyEvent'
This happens because @opentui/solid's jsx-runtime.d.ts imports from ./dist which contains auto-generated declarations with callback: any, shadowing the properly-typed exports.
Solution
Import KeyEvent from @opentui/core (which has proper type definitions) and explicitly annotate the callback parameter:
import { Renderable, RGBA, type KeyEvent } from "@opentui/core"
useKeyboard((evt: KeyEvent) => {
// ...
evt.stopPropagation() // Now properly typed
})
Test Plan
- [x]
bun turbo typecheckpasses - [x] Pre-push hooks pass
Fixes #7441