Remove `Symbol.dispose` integration in `setTimeout` and `setInterval`
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 122k
- Forks
- 37.3k
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 283
Description
As part of the [Symbol.dispose] integration, the Timeout return type of setTimeout and setInterval support disposing (https://github.com/nodejs/node/pull/48633). This was stabilized last week (https://github.com/nodejs/node/pull/58467).
I think this integration should be removed, as the web platform setTimeout / setInterval do not support Symbol.dispose and never can, because it returns a number.
This means that folks may start writing new code that is incompatible between browser and Node, just because they use the Symbol.dispose integration here. That would be unfortunate.
It would also cause one more incompatibility between server side platforms with web setTimeout, and Node setTimeout (e.g Cloudflare Workers) (cc @jasnell).
@mcollina said in person that this was made stable recently enough to still remove it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the setTimeout and setInterval entry points and the linked changes in PRs 48633 and 58467. Confirm how Timeout currently exposes Symbol.dispose and identify the compatibility expectations for browser timers; done means removing that integration while preserving the existing timer behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, backend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100