Getting unwarranted inspection errors when methods have been overloaded
So I was using the moment library and tried to use their moment.add() and moment.subtract() methods only to find that they are deprecated, except it's only one of the add and subtract methods that are marked as deprecated, there are others who simply have the same name and different order of arguments that work just fine. The problem is that Webstorm doesn't care and marks it as deprecated regardless of what my arguments are and it even tells me my arguments are wrong with a "argument type is not assignable..." message, even though they are correct and compile just fine.
In short Webstorm looks at only one "add" method in the file, it probably stops looking as soon as it finds a match, and if that method isn't the one I want to use then needless warnings appear.
So if someone could fix this it would be great, in the meantime I should just be writing a lot of suppress warnings lines I suppose?
Please sign in to leave a comment.
https://youtrack.jetbrains.com/issue/WEB-28873
>in the meantime I should just be writing a lot of suppress warnings lines I suppose?
Not necessarily -- you may just disable that particular "deprecated" inspection for particular file(s) by using custom scope.
Obviously, If you will use some other functions/methods from another class/library that also have deprecated symbols IDE will not report them (in such files) as inspection will be turned off for the whole file and not just particular statement.
https://stackoverflow.com/a/46345422/783119