-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: add missing parameter types #39013
Conversation
Both of the `clearTimeout()` and `clearInterval()` functions in the `timers` lib accepts the ID of the `Timeout` object returned by the functions in a number or string type, e.g. ```js const t = setTimeout(console.log, 5000, 'test'); clearTimeout(t[Symbol.toPrimitive]()); ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good to me. OK with it as is if people want to land it, but left a few comments suggesting some modifications I'd prefer to see.
@nodejs/timers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with @Trott's comments addressed.
Change "ID" to "primitive" and reference `timeout[Symbol.toPrimitive]()` with a hyperlink.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this change - when is the return value not a timeout?
This change is not related to the return value, it is related to the parameter type of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Landed in 68229a9 |
Both of the `clearTimeout()` and `clearInterval()` functions in the `timers` lib accepts the ID of the `Timeout` object returned by the functions in a number or string type, e.g. ```js const t = setTimeout(console.log, 5000, 'test'); clearTimeout(t[Symbol.toPrimitive]()); ``` PR-URL: #39013 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Both of the `clearTimeout()` and `clearInterval()` functions in the `timers` lib accepts the ID of the `Timeout` object returned by the functions in a number or string type, e.g. ```js const t = setTimeout(console.log, 5000, 'test'); clearTimeout(t[Symbol.toPrimitive]()); ``` PR-URL: #39013 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Both of the `clearTimeout()` and `clearInterval()` functions in the `timers` lib accepts the ID of the `Timeout` object returned by the functions in a number or string type, e.g. ```js const t = setTimeout(console.log, 5000, 'test'); clearTimeout(t[Symbol.toPrimitive]()); ``` PR-URL: #39013 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Both of the `clearTimeout()` and `clearInterval()` functions in the `timers` lib accepts the ID of the `Timeout` object returned by the functions in a number or string type, e.g. ```js const t = setTimeout(console.log, 5000, 'test'); clearTimeout(t[Symbol.toPrimitive]()); ``` PR-URL: #39013 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Both of the `clearTimeout()` and `clearInterval()` functions in the `timers` lib accepts the ID of the `Timeout` object returned by the functions in a number or string type, e.g. ```js const t = setTimeout(console.log, 5000, 'test'); clearTimeout(t[Symbol.toPrimitive]()); ``` PR-URL: #39013 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Both of the `clearTimeout()` and `clearInterval()` functions in the `timers` lib accepts the ID of the `Timeout` object returned by the functions in a number or string type, e.g. ```js const t = setTimeout(console.log, 5000, 'test'); clearTimeout(t[Symbol.toPrimitive]()); ``` PR-URL: nodejs#39013 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Both of the
clearTimeout()
andclearInterval()
functions in thetimers
lib accepts the primitive of theTimeout
object returned by the functions in a number or string type, e.g.