Problem with error "Invalid number of arguments, expected 0" when calling javascript method .toString(16)
Hi Folks,
My webstorm reports "Invalid number of arguments, expected 0" on the following code:
let hex = number.toString(16);
Yet the native .toString() method allows an optional radix parameter:
https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Number/toString
numObj.toString([radix])
Is there a way to disable the reportin on errors regarding only the toString-method in the IDE?
Or am I maybe making some other mistake?
Thanks for any help :)
Using WebStorm 2017.1.2
Build #WS-171.4249.40, built on April 25, 2017
JRE: 1.8.0_112-release-736-b21 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
Please sign in to leave a comment.
Update:
this was actually a flaw in my code.
the .toString() methhod only allows a radix parameter on numbers not on other variable types.
so the warning is just fine as it is :)
> the .toString() methhod only allows a radix parameter on numbers not on other variable types.
Not only numbers
Node 8 docs
you have to let WebStorm know explicitly what buffer type is
and, of course, Node.js Core library has to be enabled;
otherwise, Object toString() definition will be used
@Elena Pogorelova Why do we have to do anything? It's terrible IDE comparing to VS Code. Why we cannot exclude this and other warnings that is wrong by clicking in more actions? Why there's no such option?
How to disable it? I see it in vuex action inside of, for example in method: `vuexContext.commit('SET_PLAYERS_LIST', result)`,
You can suppress it for statement using comments, like
I'm getting similar warning by creating new Map() - Invalid number of arguments, expected 1. Why is that I must provide arguments for creating Map?
@Plart can't reproduce - no errors are shown for me
Can you repeat the issue in a new project?
Elena Pogorelova
Created new project (see screenshot with options), created empty test.js - the same (see screenshot)
can't reproduce:
please try ctrl+clicking on Map() in
- what definition are you taken to?
Problem has gone after updating to 2021.1 version