Refactor Bot to use TypedEventEmitter for type-safe events#89
Merged
Conversation
…ents Implemented TypedEventEmitter utility class that extends Node.js EventEmitter with compile-time type safety for event names and payloads. Refactored Bot class to extend TypedEventEmitter<BotEvents> instead of base EventEmitter, providing full type checking for all emit/on/off/once operations. Key changes: - Created packages/core/src/utils/typed-event-emitter.ts with generic TypedEventEmitter class - Added overload signatures for backward compatibility with generic EventEmitter interfaces - Updated Bot class to extend TypedEventEmitter<BotEvents> - Fixed BotEvents interface to match actual SessionLifecycleEvents payloads - Exported TypedEventEmitter from @kynetic-bot/core package All 1567 tests passing. Build successful with full TypeScript type checking. Task: @01KGGX57 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Contributor
Author
PR Review SummaryQuality Gates
Changes OverviewThis PR refactors the Bot class to use a new
Spec AlignmentThis is a technical refactoring task with no associated spec (spec_ref: null). The changes are internal improvements that don't affect observable behavior. The refactoring:
Verdict✅ Ready to merge - All quality gates pass, implementation is sound, tests verify correctness. |
chapel
added a commit
that referenced
this pull request
Feb 3, 2026
…edEventEmitter for compile-time type safety on event names and payloads. Created new TypedEventEmitter utility that extends Node.js EventEmitter with typed emit/on/off/once methods. Updated BotEvents interface to accurately reflect actual emitted events from SessionLifecycleManager. Maintained backward compatibility with overload signatures for generic EventEmitter interfaces. All 1567 tests passing, all CI checks passed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implemented TypedEventEmitter utility class that extends Node.js EventEmitter with compile-time type safety for event names and payloads. Refactored Bot class to use TypedEventEmitter instead of base EventEmitter.
Key changes:
packages/core/src/utils/typed-event-emitter.tswith generic TypedEventEmitter classTypedEventEmitter<BotEvents>Test plan
Task: @01KGGX57
🤖 Generated with Claude Code