Microsoft/TypeScript

Enum types are not checked in binary operators

クローズ

#3,845 opened on 2015/07/13

 (5 件のコメント) (0 件のリアクション) (0 人の担当者)TypeScript (13,395 件のフォーク)batch import
Breaking ChangeBugDomain: enumHelp Wanted

Repository metrics

Stars
 (108,860 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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

コントリビューターガイド