A type safe event target implementation.
type Events =
| Event<'start', StartType>
| Event<'stop', StartType>;
const target = new EventTarget<Events>();
target.addEventListener('start', startHandler);
target.removeEventListener('start', startHandler);
Note: A slight deviation from the JS standard EventTarget
target.dispatchEvent('start', payload);