Skip to content

TypeError when console.log a static property name in class #42773

Description

@regseb

Version

v16.14.2

Platform

Linux regseblaptop 5.4.0-107-generic #121-Ubuntu SMP Thu Mar 24 16:04:27 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

node -e "console.log(new class { static name = Symbol(); })"

How often does it reproduce? Is there a required condition?

The property must be static and called name.

What is the expected behavior?

{}

What do you see instead?

node:internal/util/inspect:684
  return `${constructor}${size} `;
  ^

TypeError: Cannot convert a Symbol value to a string
    at getPrefix (node:internal/util/inspect:684:3)
    at getCtxStyle (node:internal/util/inspect:724:10)
    at formatRaw (node:internal/util/inspect:1008:19)
    at formatValue (node:internal/util/inspect:817:10)
    at inspect (node:internal/util/inspect:347:10)
    at formatWithOptionsInternal (node:internal/util/inspect:2167:40)
    at formatWithOptions (node:internal/util/inspect:2029:10)
    at console.value (node:internal/console/constructor:324:14)
    at console.log (node:internal/console/constructor:360:61)
    at [eval]:1:9

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    utilIssues and PRs related to the built-in util module.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions