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: 


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

Comment actions Permalink


this was actually a flaw in my code.

the .toString() methhod only allows a radix parameter on numbers not on other variable types.

var str = "16";
var hstr = str.toString(16); // causes the warning
// Result: '16'
// not what I actually expected

var num = 16;
var hnum = num.toString(16); // causes no warning
// Result: '10'
// what I actually expected

so the warning is just fine as it is :)

Comment actions Permalink

> the .toString() methhod only allows a radix parameter on numbers not on other variable types.

Not only numbers

buffer.toString([encoding[, start[, end]]])

Node 8 docs

Comment actions Permalink

you have to let WebStorm know explicitly what buffer type is

* @type {Buffer}
let buffer;

and, of course, Node.js Core library has to be enabled;

otherwise, Object toString() definition will be used

Comment actions Permalink

@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?

Comment actions Permalink

How to disable it? I see it in vuex action inside of, for example in method: `vuexContext.commit('SET_PLAYERS_LIST', result)`,

Comment actions Permalink

You can suppress it for statement using comments, like

// noinspection JSCheckFunctionSignatures
const data54 = buffer.toString(`base64`)

Please sign in to leave a comment.