GeezerVison is showing github.com — doc: update return types for eventNames method in EventEmitter · nodejs/node@62dbd36
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: doc/api/events.md +2-2Lines changed: 2 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -603,10 +603,10 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); |
603 | 603 | added: v6.0.0 |
604 | 604 | --> |
605 | 605 |
|
606 | | -* Returns: {Array} |
| 606 | +* Returns: {string\[]|symbol\[]} |
607 | 607 |
|
608 | 608 | Returns an array listing the events for which the emitter has registered |
609 | | -listeners. The values in the array are strings or `Symbol`s. |
| 609 | +listeners. |
610 | 610 |
|
611 | 611 | ```mjs |
612 | 612 | import { EventEmitter } from 'node:events'; |
|
Collapse file
Copy file name to clipboardExpand all lines: lib/events.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -871,7 +871,7 @@ function listenerCount(type, listener) { |
871 | 871 | /** |
872 | 872 | * Returns an array listing the events for which |
873 | 873 | * the emitter has registered listeners. |
874 | | - * @returns {any[]} |
| 874 | + * @returns {(string | symbol)[]} |
875 | 875 | */ |
876 | 876 | EventEmitter.prototype.eventNames = function eventNames() { |
877 | 877 | return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; |
|