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

wrong condition check after await #42295

Closed
fy0 opened this issue Jan 12, 2021 · 2 comments
Closed

wrong condition check after await #42295

fy0 opened this issue Jan 12, 2021 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@fy0
Copy link

fy0 commented Jan 12, 2021

Bug Report

🔎 Search Terms

typescript enum no overleap.

typescript enum async no overleap.

typescript enum no overleap with async.

typescript enum no overleap promise

🕗 Version & Regression Information

  • This is a crash
  • This changed between versions 4.1.3 and nightly(2020/01/12)_
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about enum_
  • I was unable to test this on prior versions because exists on nightly version

⏯ Playground Link

Playground link with relevant code

💻 Code

enum AEnum {
  A = 1,
  B = 2
}

export class A {
  a = AEnum.A;

  async func() {
    this.a = AEnum.A;
    const f = async () => {
      this.a = AEnum.B;
    }
    await f();
    if (this.a === AEnum.B) {  // Error: This condition will always return 'false' since the types 'AEnum.A' and 'AEnum.B' have no overlap.(2367)
      console.log(333);
    }
  }
}

🙁 Actual behavior

Error

🙂 Expected behavior

Success

@MartinJohns
Copy link
Contributor

Another duplicate of #9998.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Jan 12, 2021
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants