import { EventEmitter } from 'events' ; import { EventArgs , Events } from './utilities/Events' ; type ValueOf < T > = T [ keyof T ] ; /**
 * An EventEmitter wrapper to enforce correct args on the message bus.
 */ export class ApplicationEventEmitter extends EventEmitter { public emit < K extends keyof EventArgs > ( event , ... args ) { return super . emit ( event , ... args ) ; } public on < K extends ValueOf < typeof Events > > ( event , listener ) { return super . on ( event , listener as ( ) => void ) ; } public off < K extends ValueOf < typeof Events > > ( event , listener ) { return super . off ( event , listener as ( ) => void ) ; } }