Ask about discord.js and typescript
I have an event handler call message-delete.ts
Which type should I use when message is using as function args?
Here's my code.
8 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 OPThe docs will show what type is used for each parameter in each event
thanks
Additionally, you can use the ClientEvents type exported by d.js which contains the parameter types for each event, so you can do something like
ClientEvents[Events.MessageDelete]
to get the parameter types for a given eventLike this?

that'll give you an array, not just the first parameter
so either parameters: ..., or [message, ...]: ... (destructuring)
Oh...got it