Repository navigation
refactor(sdk-trace, sdk-logs, sdk-metrics): type timers without NodeJS.Timeout - #7174
Merged
overbalance merged 2 commits intoOct 9, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7174 +/- ##
=======================================
Coverage 95.02% 95.02%
=======================================
Files 382 382
Lines 13532 13538 +6
Branches 3126 3126
=======================================
+ Hits 12859 12865 +6
Misses 673 673
🚀 New features to boost your workflow:
|
6 tasks done
Pull request dashboard statusMerged · refreshed 2026-10-09 15:49 UTC Status above doesn't look right?
|
david-luna
approved these changes
Oct 9, 2026
This was referenced Oct 12, 2026
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.
Which problem is this PR solving?
BatchSpanProcessorBase,BatchLogRecordProcessorBaseandPeriodicExportingMetricReadertyped their timer handle asNodeJS.Timeout | numberand called.unref()behind atypeof !== 'number'guard. With DOM types and no@types/node, theNodeJSnamespace does not exist and the guard narrows the handle tonever, so the shared code does not compile.A follow-up PR (#7142) adds
npm run typecheck:browser, which checks every browser build with DOM types and no@types/node. This PR is one of the changes that make that check passable.Short description of the changes
ReturnType<typeof setTimeout>andReturnType<typeof setInterval>, which already compile with both Node.js and DOM types elsewhere in the repo.unrefTimerhelper in each file casts the handle tonumber | { unref?: () => void }and callsunrefwhen present. The cast is legal in both type environments, andunref?.()tolerates runtimes that return an object without it.unrefis called once through the real scheduling path.Type of change
How Has This Been Tested?
npm run compile,npm run lint,npm run test,npm run test:browser,npm run test:webworkerfrom the root.Checklist: