Skip to content

refactor: eliminate as-any casts in ProjectionBusFactory #142

Description

@Saturate

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions