Skip to main content
Back to course
Log in
Get started
Someone wanted to learn this too, so Grasp built them a personal learning path.
Create your own
Modern JS framework with TypeScript
ยท
Module 7
Type-Safe Event Bus
1
Type-Safe Event Maps with Mapped Types
Design a type-safe event map interface using mapped types to link event names (strings) to specific payload types.
Design a type-safe event map interface using mapped types to link event names (strings) to specific payload types.
2
Generic EventBus with Constrained Event Map
Implement an `EventBus` class with a generic type parameter constrained by the event map.
Implement an `EventBus` class with a generic type parameter constrained by the event map.
3
Type-Safe Event Emitters with Mapped Types
Implement type-safe `emit` and `on` methods that enforce correct payload types for each event name using key remapping in mapped types.
Implement type-safe `emit` and `on` methods that enforce correct payload types for each event name using key remapping in mapped types.
4
Typed Observables for EventBus Events
Implement a method on the `EventBus` that returns a correctly typed observable for a specific event.
Implement a method on the `EventBus` that returns a correctly typed observable for a specific event.
5
Automatic Listener Cleanup with EventBus
Ensure the `EventBus` automatically cleans up its internal listeners when the returned observable is unsubscribed.
Ensure the `EventBus` automatically cleans up its internal listeners when the returned observable is unsubscribed.
Previous module
Pipeable Operators: Error Handling & Completion
Next module
Advanced Testing & RxJS Interoperability