d/typescriptAahmadAug 11, 2026
How do you type an event map for a custom event emitter?

I want emitter.on('user.created', (user: User) => ...) to be fully typed with event-name-to-handler mapping. I've seen patterns with mapped types, but nothing that handles both on/off/emit cleanly. What does your implementation look like?

17
0 comments

Comments (0)