Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot convert a Symbol value to a number at util.js:398:16 #11659

Closed
volkovasystems opened this issue Mar 2, 2017 · 4 comments
Closed
Labels
util Issues and PRs related to the built-in util module.

Comments

@volkovasystems
Copy link

  • Version: v6.10.0
  • Platform: Linux richeve-biyaheroes 4.4.0-64-generic #85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem: util
util.js:398
      return !(key >= 0 && key < raw.length);
               ^

TypeError: Cannot convert a Symbol value to a number
    at util.js:398:16
    at Array.filter (native)
    at formatValue (util.js:397:17)
    at formatProperty (util.js:794:15)
    at util.js:654:12
    at Array.map (native)
    at formatObject (util.js:653:15)
    at formatValue (util.js:592:16)
    at formatProperty (util.js:794:15)
    at util.js:654:12

I was experimenting and testing with my module on npm loosen at version 0.9.0

So my test case was this:

console.log( require( "util" ).inspect( loosen( global ), { "showHidden": true } ) );

When this code was run, the error above appears. Although it doesn't concern me really, but it bothers me because I was expecting util.inspect to handle things properly.

@addaleax addaleax added the util Issues and PRs related to the built-in util module. label Mar 2, 2017
@addaleax
Copy link
Member

addaleax commented Mar 2, 2017

Quick reproduction without third-party libraries:

util.inspect(Object.assign(new String(), { [Symbol('A')]: 1 }), { showHidden:true })

@addaleax addaleax added the good first issue Issues that are suitable for first-time contributors. label Mar 2, 2017
@martinakraus
Copy link

if nobody is assigned yet i will do!

@addaleax
Copy link
Member

addaleax commented Mar 6, 2017

@CodeKittey This is already being addressed in #11672, sorry… I’m removing the good first contribution label here

@addaleax addaleax removed the good first issue Issues that are suitable for first-time contributors. label Mar 6, 2017
@lpinca
Copy link
Member

lpinca commented Mar 6, 2017

Fixed by d0b93c9.

@lpinca lpinca closed this as completed Mar 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
util Issues and PRs related to the built-in util module.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants