fix(cdp-client): type-only emitter cast for Page.loadEventFired race#22
Open
sergei-aronsen wants to merge 1 commit into
Open
fix(cdp-client): type-only emitter cast for Page.loadEventFired race#22sergei-aronsen wants to merge 1 commit into
sergei-aronsen wants to merge 1 commit into
Conversation
`navigateWithRetry` subscribes to `Page.loadEventFired` via
`client.once` and removes the listener via `client.removeListener` if
the timeout branch wins. The CRI Client is an EventEmitter at runtime
so both methods exist, but @types/chrome-remote-interface@^0.34.x
only declares `on(...)`. tsc therefore rejected this file with:
src/cdp-client.ts(1394,22): error TS2339: Property 'removeListener'
does not exist on type 'Client'.
src/cdp-client.ts(1397,20): error TS2339: Property 'once'
does not exist on type 'Client'.
The error is real — it broke the build on main itself, blocking every
in-flight PR from passing CI. Fix: a minimal locally-scoped
EventEmitter-shaped interface and a single `as unknown as ...` cast.
No runtime change.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Author
|
Heads-up: this PR unblocks four others that are mergeable but red on CI for the same
Suggested merge order: this PR first, then the rebased four. Once this lands, hitting "Update branch" on each (or I can force-push an empty rebase to re-trigger CI) flips them green. |
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.
Summary
Main currently fails
tscwith:```
src/cdp-client.ts(1394,22): error TS2339: Property 'removeListener' does not exist on type 'Client'.
src/cdp-client.ts(1397,20): error TS2339: Property 'once' does not exist on type 'Client'.
```
Introduced by #18 (
ebf055e). The CRI `Client` is an EventEmitter at runtime, but `@types/chrome-remote-interface` only declares `on(...)` — not `once`/`removeListener`. Build fails on every PR until this lands.Fix
Locally-scoped EventEmitter-shaped interface + a single
as unknown as ...cast. No runtime change.Why it matters
CI is red on main, which means every open PR (#14, #15, #17, #20) is also red regardless of its own correctness. This unblocks all four.
Test plan
npm run test:unit(55/55 pass locally)npx tsc --noEmitclean🤖 Generated with Claude Code