Skip to content

refactor(types): simplify EventMap by removing DefinedEventMap and EventCallbackMap#3237

Merged
samuelgja merged 1 commit intoclientIO:masterfrom
kumilingus:fix/simplify-eventmap-types
Mar 18, 2026
Merged

refactor(types): simplify EventMap by removing DefinedEventMap and EventCallbackMap#3237
samuelgja merged 1 commit intoclientIO:masterfrom
kumilingus:fix/simplify-eventmap-types

Conversation

@kumilingus
Copy link
Contributor

Summary

  • Remove Graph.DefinedEventMap, Paper.DefinedEventMap, and mvc.EventCallbackMap<T>
  • Use EventMap directly in on() overloads — TS infers specific callback types from literal keys
  • Use ExcludeIndexSignature<EventMap> inline for LiteralUnion autocomplete
  • Use Partial<EventMap> for the object overload

Simpler approach: the index signature on EventMap already allows arbitrary strings, so a separate DefinedEventMap type is unnecessary.

Test plan

  • yarn test-ts passes

🤖 Generated with Claude Code

…and EventCallbackMap

Use EventMap directly in on() overloads — the index signature allows
arbitrary strings while TS still infers specific callback types from
literal keys. ExcludeIndexSignature is used inline where needed for
LiteralUnion autocomplete.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@samuelgja samuelgja merged commit 8400dcf into clientIO:master Mar 18, 2026
3 checks passed
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.

2 participants