-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Incorrect error generated when comparing enum values. #10989
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
Comments
So depending on what is the intent here, either make enum Direction {
LEFT = 1,
RIGHT
} or just trust that this will produce the same result: if (!direction) {
return 10;
} else {
return 0;
} |
You are absolutely right and that error actually catches a problem in our code. JS falsy .... |
Closing. |
I've had this happen to be even before it was an error. Hence : https://basarat.gitbooks.io/typescript/content/docs/enums.html#changing-the-number-associated-with-an-enum I added |
I encountered the same situation, and solved in same way.
That will be great! |
TypeScript Version: 2.0.2
Code
You get a compile error saying the Direction can't be used in ===. This is IMO incorrect.
The text was updated successfully, but these errors were encountered: