Im new to Typescript and writing a Discord bot using Typescript. I want to add a variable "commands" to the Client object. For example in Javascript, you using this:
Javascript
const { Client } = require('discord.js');
const client = new Client();
client.commands = 'commands';
console.log(client.commands);
// 'commands'
but now I want to add something similar to Typescript. But when Im using this in Typescript, I got the following error:
Property 'commands' does not exist on type 'Client'.ts(2339)
How can I solve this?
My code at the moment:
export class HalloClient {
private client: Client;
constructor() {
this.client = new Client();
this.client.commands = new Collection();
}
public start(): void {
console.log(`- Client | Starting process...`);
new RegisterEvents('../events/', this.client).load();
new MongoConnection(process.env.mongouri).createConnection();
console.log(this.client);
this.client.login(process.env.token);
}
}