繁体   English   中英

TsLint:不允许函数调用

[英]TsLint: function invocation disallowed

我的Visual Studio项目中有一些这样的TypeScript代码

if (_.isNull(user)) {
  //Do stuff
}

在保存时,TSLint给了我

Message TsLint: function invocation disallowed: _.isNull    BaseCtrl.ts    127

有我的项目Underscore.js的打字稿定义。

这条消息意味着什么?如何在我的tslint.json项目设置中修复我的代码以使TSLint满意或关闭此消息?

我相信这是使用isNull的问题,它似乎在功能禁令列表中。

https://github.com/palantir/tslint/blob/master/src/rules/banRule.ts

Web Essentials附带的默认禁止列表包括三个禁止规则:

"ban": [true,
       ["_", "extend"],
       ["_", "isNull"],
       ["_", "isDefined"]
 ],

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM