javascript console.log invalid number of arguments

In PyCharm JS files, when I try

`console.log("The value is", x)`  it warns me of "Invalid number of arguments".

There should be no warning there. That's perfectly valid for `console.log`.

 

WebStorm is FINE with this syntax, and does not show a warning.

 

How can I stop this warning in PyCharm for `console.log`?

1
10 comments

Hi,

Generally, you can Alt+Enter on any warning and select "disable inspection", which would affect only this type of inspection.

However, you're right that this is a valid expression and the warning should to be triggered. Ensure you're using the latest PyCharm version, and if the issue is still reproduced there, please provide your whole code snippet as an example.

0
Avatar
Permanently deleted user

I have the current version of PyCharm.

let x = "world.";
console.log("Hello, ", x);

I don't want to disable all complaints about Invalid Arguments for anything, of course.

It's just got the `console.log`  wrong.

 

0

I can't reproduce the issue in PyCharm 2019.2.3

Please run the inspection on this file, and provide screenshot with the results along with logs: https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files

0
Avatar
Permanently deleted user

Not seeing a way to attach the log files. 

0

Sorry to insist, but please either provide a full snippet where you see the error, or paste this snippet into a new file and share a screenshot:

let x = "world.";
console.log("Hello, ", x);

 

0
Avatar
Permanently deleted user

That IS the full snippet. Just those two lines. Put those, or any like them them anywhere and I see the issue.

 

 

0
Avatar
Permanently deleted user

I think I am being pretty clear. The IDE expects only one argument to console.log. Any additional vars throws the warning.

The snippet is just those two lines.

0

Ok. I've been asking because I can't reproduce the issue in the latest PyCharm version. Let me ask someone from WebStorm to take a look.

0

Hi Scott,

If you Ctrl-click on `log` where will you be navigated?

0
Avatar
Permanently deleted user

Oksana Chumak @...

I assume that would go to wrong definition, i.e. Math.log.
To fix:

Go to: Settings -> Languages & Frameworks ->  JavaScript -> Libraries
Then check "Node.js Core"

1

Please sign in to leave a comment.