typescript Angular:为什么 tslint 中不允许按位运算符?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/47622824/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Angular: Why are bitwise operators not allowed in tslint?
提问by Mick
We can't use bitwise operators in templates, but why are they not allowed by tslint within TypeScript code?
我们不能在模板中使用按位运算符,但为什么 TypeScript 代码中的 tslint 不允许使用位运算符?
"no-bitwise": true,
回答by Grant Eagon
Bitwise operators are often typos - for example bool1 & bool2 instead of bool1 && bool2. They also can be an indicator of overly clever code which decreases maintainability.
按位运算符通常是错别字 - 例如 bool1 & bool2 而不是 bool1 && bool2。它们也可能表明代码过于聪明,从而降低了可维护性。