fully type-safe EventEmitter
flow declaration
npm install --save @jcoreio/typed-event-emitter
// @flow
import EventEmitter from '@jcoreio/typed-event-emitter'
function createEmitter(): EventEmitter<{
eventA: [string],
eventB: [string, number],
}>
const emitter = createEmitter()
emitter.on('eventA', (foo: string) => {...})
emitter.on('eventB', (foo: string, bar: number) => {...})
emitter.emit('eventA', 'foo')
emitter.emit('eventB', 'foo', 1)