Correct pooled API return types - #13
Conversation
|
Warning Review limit reached
Next review available in: 59 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR adds Promise-aware pooled API typings, updates ChangesTyped pooled API contracts
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/comlink-worker-pool/src/index.ts`:
- Around line 12-20: Update PooledApi to explicitly override then with a
non-callable type after the mapped type, covering string-indexed proxy APIs
while preserving existing callable members. In
scripts/smoke-package-consumer.mjs, add negative consumer assertions verifying
that both direct and tracked then calls are rejected.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 68eb3a2f-8be8-4ab0-9ccb-f7de778a2e25
📒 Files selected for processing (4)
.changeset/typed-pools-return.mdpackages/comlink-worker-pool-react/src/useWorkerPool.tspackages/comlink-worker-pool/src/index.tsscripts/smoke-package-consumer.mjs
What changed
PooledApi<TProxy>type that converts every scheduled method toPromise<Awaited<TResult>>.WorkerPool#getApi()with that scheduled surface while preserving the existing runtime constructor and instance identity.useWorkerPool, including its trackedcall()helper.thenand all symbol keys from the scheduled proxy type; those methods remain available throughWorkerPool#run()where applicable.@ts-expect-errorassertions.Why
getApi()always returns Promise-producing scheduled methods at runtime, but its public declaration previously returned the raw proxy type. A synchronous proxy method could therefore compile as a synchronous value and fail at runtime. The declaration also exposedthenand symbol members that the runtime proxy deliberately suppresses.Validation
thenand symbol access fail type checking.Summary by CodeRabbit
thenand symbol properties from generated APIs to prevent invalid or unexpected usage.