node:v16.11.0
"discord.js": "^13.2.0"
I am setting up an example Discord.js bot.
In this guide, I am to the point of adding this line:
client.commands = new Collection();
Typescript then complains with: Property 'commands' does not exist on type 'Client<boolean>'
This answer seems to be in the same vein as what I want. However I'm still running into some problems. If I add a declare module "discord.js"
and declare new typings, it doesn't seem to extend the existing type, it overwrites it. And when when I do, it doesn't know what a Collection
is in my custom typings file, since that's custom to the new Discord.js library. I can't help but feel this shouldn't be required in an official guide.
I'm wondering if anyone else has made a typescript Discord bot and found a newer solution to this problem.
Thank you for your time.
extends
discord.js'sClient
and add whatever entries you need. Typings should be carried onto the new class – Timbered