adding typed events to an extended class that extends EventEmitter?
fent opened this issue · 1 comments
fent commented
hi, i'm creating a class that extends the Stream
class, which extends EventEmitter
. does this module support adding typed events to such classes?
interface MyEvents {
'foo': () => void;
}
// how do I fit tsee here so that `MyClass` has the `foo` event?
class MyClass extends Stream {
constructor() {
}
}
Morglod commented
Hi!
import { DefaultEventMap } from 'tsee';
class Stream<EventMap extends DefaultEventMap> extends EventEmitter<EventMap> {}
interface MyEvents {
'foo': () => void;
}
class MyClass extends Stream<MyEvents> {
constructor() {
}
}