为什么在tslint中不允许按位运算符? [英] Why are bitwise operators not allowed in tslint?

查看:121
本文介绍了为什么在tslint中不允许按位运算符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们不能在模板中使用按位运算符,但是为什么在TypeScript代码中tslint不允许使用它们?

We can't use bitwise operators in templates, but why are they not allowed by tslint within TypeScript code?

"no-bitwise": true,

推荐答案

按位运算符通常是拼写错误-例如bool1&bool2代替bool1&&布尔2.它们也可能表示代码过于聪明,从而降低了可维护性.

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.

https://palantir.github.io/tslint/rules/no-bitwise/

这篇关于为什么在tslint中不允许按位运算符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆