Skip to content

refactor(core): give EventRouter typed handlers - #795

Merged
janbjorge merged 2 commits into
mainfrom
typing/07-event-router
Sep 6, 2026
Merged

refactor(core): give EventRouter typed handlers#795
janbjorge merged 2 commits into
mainfrom
typing/07-event-router

Conversation

@janbjorge

Copy link
Copy Markdown
Owner

Part 7/9 of the strict-mypy series. Stacked on #794; merge in order, I rebase the rest after each merge.

EventRouter takes one typed handler per event type and dispatches
with an exhaustive isinstance chain, so each handler receives the
concrete event class and mypy proves every event type is handled. The
string-keyed register() decorator is gone; it could only be typed as
Callable[..., None]. default_event_router() wires the same three
handlers as before.

@janbjorge
janbjorge force-pushed the typing/07-event-router branch 2 times, most recently from 4e18132 to 3b16c0f Compare September 6, 2026 17:48
@janbjorge
janbjorge force-pushed the typing/07-event-router branch from 3b16c0f to 6527864 Compare September 6, 2026 18:17
@janbjorge
janbjorge force-pushed the typing/07-event-router branch from 6527864 to 0fdfa66 Compare September 6, 2026 18:24
@janbjorge
janbjorge force-pushed the typing/07-event-router branch from 0fdfa66 to e695549 Compare September 6, 2026 18:31
@janbjorge
janbjorge force-pushed the typing/07-event-router branch from e695549 to 422b9db Compare September 6, 2026 18:33
@janbjorge
janbjorge force-pushed the typing/07-event-router branch from 422b9db to a74e559 Compare September 6, 2026 18:38
Base automatically changed from typing/06-adapters-no-any to main September 6, 2026 18:41
EventRouter takes one typed handler per event type and dispatches
with an exhaustive isinstance chain, so each handler receives the
concrete event class and mypy proves every event type is handled. The
string-keyed register() decorator is gone; it could only be typed as
Callable[..., None]. default_event_router() wires the same three
handlers as before.
@janbjorge
janbjorge force-pushed the typing/07-event-router branch from a74e559 to 1d50927 Compare September 6, 2026 18:41
@janbjorge
janbjorge merged commit a817b34 into main Sep 6, 2026
20 checks passed
@janbjorge
janbjorge deleted the typing/07-event-router branch September 6, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant