Senior Typescript
Senior
technical
How would you design a generic type-safe event emitter in TypeScript that allows subscribing to specific event types and emits them with typed payloads? Consider the ability to handle multiple listeners for each event type and the need to unregister listeners. Discuss the structure and provide example usage.
Suggested Answer