Microsoft/TypeScript

Enum types are not checked in binary operators

已關閉

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

 (5 則留言) (0 個反應) (0 位負責人)TypeScript (13,395 個分叉)batch import
Breaking ChangeBugDomain: enumHelp Wanted

倉庫指標

星標
 (108,860 顆星)
PR 合併指標
 (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

貢獻者指南