webstormjetbrains-idecode-inspection

Unjustified "variable is possibly null" warning in WebStorm


I like all the inspections in WebStorm, which help me clean up my code and find potential issues. But I fail to understand some warnings and they are getting into my way.

For example in the screenshot below you can see that I explicitly check if the variable result is null, and if so, assign an empty array to it. However, just below that WebStorm gives me a warning that the variable result is possibly null.

enter image description here

What is going on here? Do I have to clear a cache or is this simply a bug in WebStorm's inspections? Or am I missing something completely and the Warning is justified?

Edit: If this is a bug, it might be helpful to know that the variable is explicitly set to null on declaration (let result = null;).


Solution

  • Submitted to developers, please vote for WEB-48756 to be notified on any progress with it