Skip to content

fix(tui): add KeyEvent type to useKeyboard callback (#7441) - #7443

Closed
CasualDeveloper wants to merge 1 commit into
anomalyco:devfrom
CasualDeveloper:fix/keyevent-stoppropagation-type
Closed

CasualDeveloper wants to merge 1 commit into
anomalyco:devfrom
CasualDeveloper:fix/keyevent-stoppropagation-type

Conversation

@CasualDeveloper

Copy link
Copy Markdown
Contributor

Summary

  • Add explicit KeyEvent type import from @opentui/core
  • Annotate useKeyboard callback parameter with KeyEvent type 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

  • bun turbo typecheck passes
  • Pre-push hooks pass

Fixes #7441

@github-actions

github-actions Bot commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@CasualDeveloper
CasualDeveloper force-pushed the fix/keyevent-stoppropagation-type branch 8 times, most recently from d5492e8 to 1afc9f0 Compare January 14, 2026 08:44
@CasualDeveloper CasualDeveloper changed the title fix(tui): add KeyEvent type annotation to useKeyboard callback fix(tui): add KeyEvent type to useKeyboard callback (#7441) Jan 14, 2026
@CasualDeveloper

Copy link
Copy Markdown
Contributor Author

@adamdotdevin another quick fix you can merge 👀

@CasualDeveloper
CasualDeveloper force-pushed the fix/keyevent-stoppropagation-type branch 5 times, most recently from b73fed0 to 3ea6e63 Compare January 17, 2026 10:15
The useKeyboard callback in dialog.tsx uses evt.stopPropagation(),
but TypeScript couldn't verify the method exists because @opentui/solid's
jsx-runtime.d.ts imports from ./dist which has loosely typed auto-generated
declarations (callback: any).

Import KeyEvent from @opentui/core and explicitly annotate the callback
parameter to restore proper type checking.

Fixes anomalyco#7441
@CasualDeveloper
CasualDeveloper force-pushed the fix/keyevent-stoppropagation-type branch from 3ea6e63 to ca303b3 Compare January 17, 2026 10:46
@CasualDeveloper

CasualDeveloper commented Jan 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Closing as obsolete: confirmed on origin/dev that bun turbo typecheck passes without this change.

@CasualDeveloper
CasualDeveloper deleted the fix/keyevent-stoppropagation-type branch January 18, 2026 18:19
@CasualDeveloper

CasualDeveloper commented Jan 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Closing as obsolete: can’t reproduce on origin/dev anymore; bun turbo typecheck is clean; no action needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeScript error: stopPropagation does not exist on KeyEvent type (#7443)

1 participant