node:v16.11.0
"discord.js": "^13.2.0"
I am currently setting up a Discord bot example using Discord.js.
Following the steps outlined in this guide, I have reached the point of adding the line below:
client.commands = new Collection();
However, when I do this, Typescript throws an error:
Property 'commands' does not exist on type 'Client<boolean>'
Although I found a potential solution in this answer, I still encounter some difficulties. When attempting to extend the existing type with a
declare module "discord.js"
and defining new typings, it seems to overwrite instead of extending. Furthermore, my custom typings file doesn't recognize what a Collection
is since it's specific to the updated Discord.js library. This makes me question whether such modifications should be necessary following an official guide.
If you've faced similar challenges while creating a typescript Discord bot and have discovered a more recent solution, I would greatly appreciate any insights or suggestions.
Thank you for taking the time to read this.