fix(cli): use ReturnType<typeof setTimeout> for timer map#789
fix(cli): use ReturnType<typeof setTimeout> for timer map#789chenrui333 wants to merge 1 commit into
Conversation
Deno 2.8+ / TypeScript 6.0 changed setTimeout's return type from number to Timeout, causing TS2345 when storing timer IDs in the WeakMap. Use ReturnType<typeof setTimeout> for cross-version compat. Signed-off-by: Rui Chen <rui@chenrui.dev>
There was a problem hiding this comment.
Code Review
This pull request updates the type of the values in the signalTimers WeakMap in packages/cli/src/lookup.ts from number to ReturnType to improve cross-platform compatibility. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR corrects the type annotation for the ChangesSignal Timer Type Correction
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ 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 |
|
Thanks for your contribution! Since it should be fixed in 2.2.x versions too, I will cherry-pick your commit instead of merging it. |
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
The fix uses ReturnType<typeof setTimeout> for the signalTimers WeakMap in @fedify/cli, which is compatible across Deno 2.8+ / TypeScript 6.0 where setTimeout returns Timeout instead of number. #789
|
Fixed in v2.0.20, v2.1.16, and v2.2.5. |
Summary
Deno 2.8+ / TypeScript 6.0 changed
setTimeout's return type fromnumbertoTimeout, causing TS2345 when storing timer IDs in thesignalTimersWeakMap.Fix
Use
ReturnType<typeof setTimeout>which is compatible across all TypeScript/Deno versions.