Events enum vs ClientEvents interface
is there meant to be differences between the
Events
enum and ClientEvents
interface? for example, Raw
is in Events but not in ClientEvents
. i'm curious if they are meant to have the same events and have fallen out of sync, or if its intended.
ClientEvents
interface
https://github.com/discordjs/discord.js/blob/main/packages/discord.js/typings/index.d.ts#L4726
Events
enum
https://github.com/discordjs/discord.js/blob/main/packages/discord.js/typings/index.d.ts#L4950
what i would expect to exist in ClientEvents
but doesnt
3 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.The enum maps to the string value while the interface maps to the arguments for that event
raw is private. It shouldn’t have been documented in the first place tbh
i found https://github.com/discordjs/discord.js/pull/7970 which goes into more detail about why its private, and that all makes sense. what i don't understand is why it's included in the exported
Events
if listening to it is not supported.
i think it'd be better if either raw
was moved from Events
to something that isn't exported, or arg types for raw
were added to ClientEvents
. judging from the sentiment on #7970, the former is probably more appropriate. but since raw
has been on that type for so long, i'm guessing people wouldn't be interested in moving it around just because it's a bit inconsistent with the other events, either.
thanks for the information though, i just wanted to learn more about why it is the way it is. i can work around my issues on my side by pretending Events.Raw
doesn't exist.