Much easier to interpolate the hardcoded token rather than a string...despite the string being a final string and not some concatenation or dynamic value
Much easier to interpolate the hardcoded token rather than a string...despite the string being a final string and not some concatenation or dynamic value
However, it's a common typed-javascript idiom to use string-indexing when you're probing a value of unknown type. Even Typescript has settings to accept this.
I guess my question is, how can I make the
ob.something
NOT be (listed as) an error? When is it not an error (according to WebStorm linter)?In any case, like any inspection, you can adjust its severity to whatever you find appropriate, including "don't show it at all".
File > Settings > Editor > Inspections > Javascript and Typescript > General > Unresolved reference.
Or directly from the "Show Context Actions" action (Alt+enter or whatever you have it set to, the same combination that shows refactoring actions), you can navigate the inspection like a submenu and select "Edit inspection profile setting".
The problem is the long list often hides real errors in it. I would like to spot those more easily.
But I'll try your suggestions, maybe there's a way to make this warning disappear altogether from the list.
I still don't think, and don't understand, why it is a "problem" since the equivalent longer expression is not. It feels like WebStorm is mandating its own JavaScript-rules on me and my programming style.
Unresolved variable someFieldName
which are preceded by a RED round icon containing a '!'.It certainly looks like an error because it is red and there are also other problems listed which are preceded by a yellow-background icon.
So I think WebStorm thinks this is an error, not a warning.