SonarJS
SonarJS copied to clipboard
Improve S2259 `null-dereference`: consider any kind of nullable target objects
The rule currently limits itself to raising issues on member expressions in which the possibly nullable target object is an identifier:
var nullable = /* ... */;
console.log(nullable.bar);
We should extend the scope of the rule and relax this constraint so that it is able to raise on any kind of nullable target objects:
var nullable = /* ... */;
console.log(nullable().bar);
Reported in https://community.sonarsource.com/t/identify-npe-in-typescript-js/60074