feat: use Node.js timers by default#31272
Merged
bartlomieju merged 7 commits intodenoland:mainfrom Nov 13, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR makes a breaking change by replacing the Web API timer implementations with Node.js timer APIs as the default for global setTimeout, setInterval, clearTimeout, and clearInterval functions. The main difference is that Node.js timers return Timeout objects instead of numeric IDs, which could affect code that checks typeof id === "number".
Key Changes
- Switched from
ext:deno_web/02_timers.jstonode:timersfor global timer functions - Removed the unstable
nodeGlobalsfeature flag since Node.js timers are now the default behavior - Removed the unused Web API timers import from this file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dsherret
approved these changes
Nov 13, 2025
Contributor
dsherret
left a comment
There was a problem hiding this comment.
Unfortunate, but I think we should do this. Too much server side code relies on this and it works "ok" with most existing web code.
LGTM
bartlomieju
added a commit
to bartlomieju/deno
that referenced
this pull request
Nov 17, 2025
This commit changes global `setTimeout` and `setInterval` APIs (along
their `clear*` counterparts) to use Node.js APIs instead of the Web
APIs.
For real world usage we expect no difference in code and behavior,
unless user relies on following checks:
```
const id = setTimeout(...);
if (typeof id === "number") {
// ...
}
```
In which case the conditional should be changed to `if (id)`
12 tasks
bartlomieju
added a commit
to bartlomieju/deno
that referenced
this pull request
Dec 3, 2025
This reverts commit 7ada8d6.
bartlomieju
added a commit
to bartlomieju/deno
that referenced
this pull request
Dec 3, 2025
This reverts commit 7ada8d6.
bartlomieju
added a commit
to bartlomieju/deno
that referenced
this pull request
Dec 4, 2025
This reverts commit 7ada8d6.
bartlomieju
added a commit
that referenced
this pull request
Dec 4, 2025
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.
This commit changes global
setTimeoutandsetIntervalAPIs (along theirclear*counterparts) to use Node.js APIs instead of the Web APIs.For real world usage we expect no difference in code and behavior, unless user relies on following checks:
In which case the conditional should be changed to
if (id)