Skip to content

PromiseConstructor error message is not using the correct format for newer versions of ECMAScript #40929

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

Closed
Vboivin opened this issue Oct 3, 2020 · 1 comment · Fixed by #40931
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@Vboivin
Copy link
Contributor

Vboivin commented Oct 3, 2020

TypeScript Version: Nightly

Search Terms:

  • Promises
  • Error Messages
  • Compiler

Code

// es2018 feature on Promise Type (correct error behavior)
new Promise(() => {}).finally();

// es2020 feature on PromiseConstructor Type (wrong error behavior)
Promise.allSettled([]);

// esnext feature on PromiseConstructor Type (wrong error behavior)
Promise.any([]);

Expected behavior:

  • Property 'allSettled' does not exist on type 'PromiseConstructor'. Do you need to change your target library? Try changing the lib compiler option to 'es2020' or later.
  • Property 'any' does not exist on type 'PromiseConstructor'. Do you need to change your target library? Try changing the lib compiler option to 'esnext' or later.

Actual behavior:

  • Property 'allSettled' does not exist on type 'PromiseConstructor'.
  • Property 'any' does not exist on type 'PromiseConstructor'.

Playground Link:

Related Issues:

How To Resolve

Vboivin pushed a commit to Vboivin/TypeScript that referenced this issue Oct 4, 2020
@Vboivin Vboivin changed the title Better PromiseConstructor error message for newer versions of ECMAScript PromiseConstructor error message is not using the correct format for newer versions of ECMAScript Oct 5, 2020
@andrewbranch andrewbranch added the Bug A bug in TypeScript label Oct 5, 2020
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 4.1.1 milestone Oct 5, 2020
@DanielRosenwasser
Copy link
Member

Thanks for catching that 🙂

andrewbranch pushed a commit that referenced this issue Oct 5, 2020
…AScript (#40931)

* Update package-lock.json

* Update package-lock.json

* Update package-lock.json

* Update package-lock.json

* Fixes #40929

Co-authored-by: TypeScript Bot <[email protected]>
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants