Skip to content

Conversation

@CasualDeveloper
Copy link
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
Copy link
Contributor

github-actions bot commented Jan 9, 2026

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

No duplicate PRs found

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 8cee34c to b796891 Compare January 10, 2026 11:40
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

1 participant