class Foo extends (EventEmitter as new () => TypedEmitter<{1: () => void}>) {
constructor() {
super();
this.emit("1"); // error should be no error
}
}
After fix:
class Foo extends (EventEmitter as new () => TypedEmitter<{1: () => void}>) {
constructor() {
super();
this.emit("1"); // no error
this.emit(1); // no error
// a number as event name also works in node but for some reason it is not documented like that
}
}
class Bar extends (EventEmitter as new () => TypedEmitter<{
"1": () => void,
}>) {
constructor() {
super();
this.emit("1"); // no error
this.emit(1); // no error
// known issue:
this.emit(3); // no error
// I found no way to get the number from a string
// but the arguments are typed correctly:
this.emit(3,""); // error
}
}
Problem:
After fix: