facebook / facebook/flow

Confuse behavior when comparing enum

Open
#4,347 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

https://flow.org/try/#0PTAEAEDMBsHsHcBQ0CmAXUBDAXKA5JngD54BGxeAxnqALz6GKICWkoAFJnfXgCZ4BKUAG9QIUADtYoFACdZsWYgC+TVp26gAjENHi5CpapZsNtc-n66xYA4pVrTXc-R0ibk6XaNA

![image](https://user-images.githubusercontent.com/5233940/28022913-081820c0-65bf-11e7-9a6d-6e6f9c677487.png)

I think this is a quite strange behavior comparing to [typescript version](http://www.typescriptlang.org/play/index.html#src=let%20a%3A%20'a'%7C'b'%7C'c'%20%3D%20'a'%0D%0A%0D%0Aif%20(a%20%3D%3D%20'd')%20%7B%20%2F%2F%20no%20error%0D%0A%7D%0D%0A%0D%0Aif(a%20%3D%3D%201)%20%7B%20%2F%2F%20error%0D%0A%7D%0D%0A%0D%0Aif%20(a%20%3D%3D%3D%20'd')%20%7B%20%2F%2F%20error%0D%0A%7D%0D%0A%0D%0Aif%20(a%20%3D%3D%3D%201)%20%7B%20%2F%2F%20no%20error%0D%0A%7D),
![image](https://user-images.githubusercontent.com/5233940/28022872-eb14db8a-65be-11e7-893c-258efdf3b007.png)

and personaly I'm more agree with the typescript version, because people will make less mistack.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.