Trouble with event emitter


#1

Hello whoever is reading this, I’m having trouble with the event emitter.

For example, I try to make my client listen to an event like this:

client.on(f.slice(0, f.length - 3), ...args => {});

And I keep getting the error:
undefined is not a function

I’ve tried this with my custom event emitter, as well as node’s built in one and eventemitter3, same error.

I have no idea what’s causing this, I’ve tried it in different projects, different variable names, everything. And the worst part about it, sometimes it does work.

If anyone knows if that’s a bug or there is a workaround for it, please hit me up on Discord - MoordMachineYT#1910 - or just respond here.


#2

Little update: I wasn’t able to reproduce this locally, and I’m having the same problem with any other possible methods to listen to the events.


#3

I’m assuming the problem is the spread operator. What does args contain?