diff --git a/doc/api/events.md b/doc/api/events.md index 1a7d909e18c591..7ea6ebd03805c3 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -603,10 +603,10 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); added: v6.0.0 --> -* Returns: {Array} +* Returns: {string\[]|symbol\[]} Returns an array listing the events for which the emitter has registered -listeners. The values in the array are strings or `Symbol`s. +listeners. ```mjs import { EventEmitter } from 'node:events'; diff --git a/lib/events.js b/lib/events.js index 999ee4ec746d18..5bfe95c84ab198 100644 --- a/lib/events.js +++ b/lib/events.js @@ -871,7 +871,7 @@ function listenerCount(type, listener) { /** * Returns an array listing the events for which * the emitter has registered listeners. - * @returns {any[]} + * @returns {(string | symbol)[]} */ EventEmitter.prototype.eventNames = function eventNames() { return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];