Build an event emitter or pub/sub where event names are a typed map to payloads, so emit and on are checked for correct event names and payload shapes.
## CONTEXT Untyped event emitters are a classic source of runtime bugs: a typo in an event name or a wrong payload shape goes unnoticed until production. In 2026 the standard fix is an event map type — a record from event name to payload type — that drives the emitter's emit, on, and off signatures so the compiler…
Premium Prompt
Unlock this prompt — and all 30,000+ expert-crafted prompts — with Pro.
Unlock with Pro