Changed comments UI listener option typing#28733
Conversation
Replaced keydown removeEventListener any casts with EventListenerOptions casts.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughAcross five components in 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…mments-ui
passive is not a valid removeEventListener option (EventListenerOptions
only accepts capture) and is ignored on removal. The paired
addEventListener calls all use {passive: true} with no capture, so the
matching removals only need capture=false, which is the default. Dropping
the third argument entirely removes the need for the as any / as
EventListenerOptions casts across all 8 listener removals.
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx build @tryghost/announcement-bar |
✅ Succeeded | <1s | View ↗ |
nx build @tryghost/activitypub |
✅ Succeeded | 2s | View ↗ |
nx build @tryghost/sodo-search |
✅ Succeeded | <1s | View ↗ |
nx build @tryghost/signup-form |
✅ Succeeded | <1s | View ↗ |
nx build @tryghost/comments-ui |
✅ Succeeded | <1s | View ↗ |
nx build @tryghost/portal |
✅ Succeeded | <1s | View ↗ |
nx build @tryghost/admin-toolbar |
✅ Succeeded | <1s | View ↗ |
nx run @tryghost/admin:build |
✅ Succeeded | 19s | View ↗ |
Additional runs (6) |
✅ Succeeded | ... | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-06-23 18:44:34 UTC

Replaced the
anycasts onkeydownremoveEventListenercalls incomments-uiwithEventListenerOptions.The runtime behavior is intended to stay the same. These listeners are added with
{passive: true}, and the cleanup calls already passed the same options object when removing them. The previous code usedas anybecauseremoveEventListeneris typed withEventListenerOptions, whilepassivebelongs toAddEventListenerOptions.An alternative would be to remove
{passive: true}from theremoveEventListenercalls entirely, because listener removal only depends on the event type, listener function, and capture flag. I avoided that here to keep the existing cleanup shape unchanged and make this PR a narrow typing cleanup.Verification:
This currently fails on existing package-wide
comments-uiTypeScript issues, mainly missing React declarations and implicitanyerrors. The updatedremoveEventListenerlines are not implicated in the failure.