Skip to content

events: type of eventName allowed besides string/symbol #31331

@Flarna

Description

@Flarna
  • Version: 13.6.0
  • Platform: all
  • Subsystem: events

Docs tell that eventName should be of type string or symbol. But actually there is no type check and it works to use e.g. number, function or null - they just get coerced to a string (which is quite nice for functions).

There are also two tests which use non string/symbol: e.g. test-event-emitter-max-listeners-warning-for-null.js and test-event-emitter-subclass.js.

Are the docs wrong or the implementation? Or is this just some relict which can't be changed but should be hidden in docs as there were already type checks implemented (see 0468861).

Edit:
Maybe some more background on this: I worked on adding typechecks for types and at that time I discovered a few failing tests and as followup the commit linked above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions