Skip to content

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

Closed
@Vboivin

Description

@Vboivin

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

Activity

added a commit that references this issue on Oct 4, 2020
d76b6f3
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[/+] on Oct 5, 2020
DanielRosenwasser

DanielRosenwasser commented on Oct 5, 2020

@DanielRosenwasser
Member

Thanks for catching that 🙂

added a commit that references this issue on Oct 5, 2020
5766160
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Participants

      @DanielRosenwasser@andrewbranch@typescript-bot@Vboivin

      Issue actions

        PromiseConstructor error message is not using the correct format for newer versions of ECMAScript · Issue #40929 · microsoft/TypeScript