Skip to content
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

node:timers should also export promises as field like node:fs does #51237

Closed
axkibe opened this issue Dec 20, 2023 · 1 comment · Fixed by #51246
Closed

node:timers should also export promises as field like node:fs does #51237

axkibe opened this issue Dec 20, 2023 · 1 comment · Fixed by #51246
Labels
feature request Issues that request new features to be added to Node.js. timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.

Comments

@axkibe
Copy link
Contributor

axkibe commented Dec 20, 2023

What is the problem this feature will solve?

Following example:

import fs from 'node:fs';
import fsPromises from 'node:fs/promises';
import timers from 'node:timers';
import timersPromises from 'node:timers/promises';
console.log( !!fs.promises );
console.log( !!fsPromises );
console.log( !!timers.promises );
console.log( !!timersPromises );

returns:

true
true
false
true

It should return 4x true. Its not a big deal, but a little cumbersome in case some code wants the promised and unpromised version.

What is the feature you are proposing to solve the problem?

also export promises into the field imported by 'node:timers'.

What alternatives have you considered?

The workaround is easy just
import timersPromises from 'node:timers/promises';
but it's inconsistent to node:fs

@axkibe axkibe added the feature request Issues that request new features to be added to Node.js. label Dec 20, 2023
@marco-ippolito marco-ippolito added the timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout. label Dec 20, 2023
nodejs-github-bot pushed a commit that referenced this issue Dec 23, 2023
PR-URL: #51246
Fixes: #51237
Reviewed-By: Raz Luvaton <rluvaton@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
@axkibe
Copy link
Contributor Author

axkibe commented Dec 23, 2023

Nice! Thanks.

RafaelGSS pushed a commit that referenced this issue Jan 2, 2024
PR-URL: #51246
Fixes: #51237
Reviewed-By: Raz Luvaton <rluvaton@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
richardlau pushed a commit that referenced this issue Mar 25, 2024
PR-URL: #51246
Fixes: #51237
Reviewed-By: Raz Luvaton <rluvaton@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
@RedYetiDev RedYetiDev moved this from Awaiting Triage to Done in Node.js feature requests Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants