Better Way Of Declaring Variables For Tests

In a lot of my tests, I use beforeEach to setup variables for the testing file. That code looks like this:
let text_channel: TextChannel;
let client: Client;
beforeEach(async () => {
const data = await setupBot();
client = data.client;
text_channel = mockTextChannel(client);
});
let text_channel: TextChannel;
let client: Client;
beforeEach(async () => {
const data = await setupBot();
client = data.client;
text_channel = mockTextChannel(client);
});
I don't love having to declare the types of what I'm using as it's possible to infer them from their return type, however, since I have to access them outside of the scope I need to declare them first. Is there a better way of doing this where I don't have to set their types? Thanks
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server