Deviopath › TypeScript

Summarize UI Events

Medium · Discriminated Unions

An AppEvent is a click, a keypress or a scroll (the type property tells which).

Write summarizeEvents(events: AppEvent[]): Summary that returns:

- clicks: how many click events there were

- typed: all pressed keys joined together, in order

- scrolled: the sum of all scroll delta values

Next: Permission Bit Flags