Visitar URL original
Type definitions for `Promise.withResolvers()` · Issue #56483 · microsoft/TypeScript · GitHub
The Wayback Machine - https://web.archive.org/web/20240924050546/https://github.com/microsoft/TypeScript/issues/56483
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

Type definitions for Promise.withResolvers() #56483

Closed
mkubilayk opened this issue Nov 21, 2023 · 3 comments · Fixed by #56593
Closed

Type definitions for Promise.withResolvers() #56483

mkubilayk opened this issue Nov 21, 2023 · 3 comments · Fixed by #56593
Assignees
Labels
Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fix Available A PR has been opened for this issue

Comments

@mkubilayk
Copy link
Contributor

mkubilayk commented Nov 21, 2023 •

⚙ Compilation target

esnext

⚙ Library

ESNext

Missing / Incorrect Definition

Promise.withResolvers() is missing type definitions.

It is a Stage 3 TC39 proposal that is shipping in Chromium 119, Firefox 121 and soon in other runtimes.

Sample Code

const { promise, resolve, reject } = Promise.withResolvers();
//                                           ^ Property 'withResolvers' does not exist on type 'PromiseConstructor'.(2339)

Documentation Link

https://github.com/tc39/proposal-promise-with-resolvers

@andrewbranch andrewbranch added the Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript label Nov 21, 2023
@andrewbranch andrewbranch added this to the TypeScript 5.4.0 milestone Nov 21, 2023
@mkubilayk
Copy link
Contributor Author

An update from this week's TC39 meeting: the proposal advanced to Stage 4 yesterday. 🥳

https://twitter.com/robpalmer2/status/1729216597623976407

@linusg
Copy link
Contributor

linusg commented Nov 28, 2023

@sandersn If you haven't started working on this yet I'd be interested in submitting a PR!

@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Nov 29, 2023
@angelhdzmultimedia
Copy link

Hello! Just to confirm:

I tried with typescript 5.3.3 and didn't work, but upgraded to 5.4.0-dev.20240215 and it worked.
So I set my VSCode workspace typescript version to that one instead.

So I'll wait until VSCode typescript's version gets updated to officially start using Promise.withResolvers.

Good stuff! 🔥😍🎉👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants