I want to add custom (typed) events to the Client class.
So i have this class that extends the Client class and it just adds some utilities i use. I want to add a few more events to that extending class.
Now usually this would be no problem as I just emit using the already baked-in EventEmitter in the Client class. However, I would like to additionally add typings using the same already integrated system that DJS uses.
Is this even possible?
FYI, by typings i mean types for the parameters when i listen to an event:
5 Replies
- What's your exact discord.js
npm list discord.js and node node -v version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅ Marked as resolved by OPIt's js related #other-js-ts
But aw answer here. You can create your own type based on this
Fair enough, thanks nonetheless!
You're welcome 🙂
Some typescript wizardry later, this is the solution I came up with if anyone reading wants it;