Chris Barr
Chris Barr

Reputation: 33972

TsLint: function invocation disallowed

I have some TypeScript code like this in my Visual Studio project

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

And on save, TSLint gives me

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

I do have the TypeScript definitions for Underscore.js in my project.

What does this message mean & how do I either fix my code to make TSLint happy or turn off this message in my tslint.json project settings?

Upvotes: 4

Views: 1894

Answers (1)

Gent
Gent

Reputation: 2685

I believe this is an issue with using isNull which appears to be on the function ban list.

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

The default ban list that comes with Web Essentials includes three ban rules:

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

Upvotes: 4

Related Questions