Base constraint for event handler maps.
Maps event names to handler function signatures.
IMPORTANT: The use of any here is intentional and necessary for proper type system behavior:
Variance Requirements: Function parameters are contravariant. Using unknown[] or
readonly unknown[] causes type incompatibility with transformed types like WithSender<T>
which prepends named parameters to the function signature.
Type Inference: any[] allows TypeScript's type inference to flow bidirectionally:
Through generic constraints (e.g., TMessageMap extends EventMap)
To call sites and type transformations
Constraint Satisfaction: Types with named parameters like
(sender: DirectIpcTarget, userId: string) => void must satisfy this constraint.
Only any[] allows this due to how TypeScript handles tuple vs array variance.
This is a legitimate use case for any in generic constraints. The actual type safety
comes from the concrete generic type parameter, not from the constraint itself.
See docs/EventMap-Any-Justification.md for detailed explanation.
Base constraint for event handler maps. Maps event names to handler function signatures.
IMPORTANT: The use of
anyhere is intentional and necessary for proper type system behavior:Variance Requirements: Function parameters are contravariant. Using
unknown[]orreadonly unknown[]causes type incompatibility with transformed types likeWithSender<T>which prepends named parameters to the function signature.Type Inference:
any[]allows TypeScript's type inference to flow bidirectionally:{ 'user-updated': (userId: string) => void })TMessageMap extends EventMap)Constraint Satisfaction: Types with named parameters like
(sender: DirectIpcTarget, userId: string) => voidmust satisfy this constraint. Onlyany[]allows this due to how TypeScript handles tuple vs array variance.This is a legitimate use case for
anyin generic constraints. The actual type safety comes from the concrete generic type parameter, not from the constraint itself.See docs/EventMap-Any-Justification.md for detailed explanation.