Microsoft/TypeScript

Enum types are not checked in binary operators

Open

#3,845 建立於 2015年7月13日

在 GitHub 查看
 (5 留言) (0 反應) (0 負責人)TypeScript (6,726 fork)batch import
Breaking ChangeBugDomain: enumHelp Wanted

倉庫指標

Star
 (48,455 star)
PR 合併指標
 (平均合併 6天 17小時) (30 天內合併 9 個 PR)

描述

I ran into this for real while trying to fix a bug in the compiler. We disallow assigning one enum to another if you use the = operator. But we do not disallow it for any of the compound assignment operators. Nor do we disallow for bitwise operators. I think we should disallow all of them.

enum E { }
enum F { }

var e: E;
var f: F;

e = f; // Error
e |= f; // No error
var g = e | f; // No error, g is number

貢獻者指南