ProjectionBusFactory has 62 as any casts, one per event subscription. The event bus speaks BaseEvent but each projector expects a specific event type, and the bridge between them is an unchecked cast. If a payload field is renamed or removed, TypeScript won't catch the mismatch.
A generic on<E>() helper can concentrate the single unavoidable cast in one place while making every call site type-safe. This also replaces string literals with typed event constants, catching typos at compile time.
Drops total any count from 203 to 141.
PR: #140
ProjectionBusFactory has 62
as anycasts, one per event subscription. The event bus speaksBaseEventbut each projector expects a specific event type, and the bridge between them is an unchecked cast. If a payload field is renamed or removed, TypeScript won't catch the mismatch.A generic
on<E>()helper can concentrate the single unavoidable cast in one place while making every call site type-safe. This also replaces string literals with typed event constants, catching typos at compile time.Drops total
anycount from 203 to 141.PR: #140