-
-
Notifications
You must be signed in to change notification settings - Fork 78
Closed
Description
The #96 introduces a regression when emittery is used as a sub-class. Lemme share a code sample.
const Emittery = require("emittery");
class MyEmitter extends Emittery {
async emit(eventName, data) {
return super.emit(eventName, data)
}
}
new MyEmitter().on('foo', () => {})Adding a listener foo will raise an exception from this line https://github.com/sindresorhus/emittery/blob/main/index.js#L262, since it is calling this.emit with three arguments.
Now, I can update the emit method on my class to accept the 3rd argument and pass it to super.emit. However, then TypeScript complains that the emit method takes only two arguments.
Metadata
Metadata
Assignees
Labels
No labels