Change TS type of Client
I've made some changes to the default Client by adding a config file and some collections. While this all works I can't figure out a way to change the type of the Client so it reflects my changes.
Here's som of my code
I've tried adding a TS file as follows but it causes more issues that it solves
I understand why the issues exist but not how I can fix them
3 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!We highly recommend you extend the
Client
structure properly instead of just attaching custom properties like .commands
to the regular discord.js Client
instance.
- Using typescript, you might want to consider casting or augmenting the module typeFor the any, I'm in the process of fixing those
I'll have a look at those links, thanks
I'm confused though.
The code I sent above is a snippet, my custom client actually does a lot more in the background.
The issue I have is, say when an interaction is triggered I get the interaction. If I want to do
interaction.client.commandCollection
it works but eslint is not happy. How would I go about fixing that since it doesn't look like casting can do it ?
God I’m an idiot