Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export event types for use with abstract Client class #1083

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

Tapppi
Copy link
Contributor

@Tapppi Tapppi commented Jun 25, 2024

Without exported event types, they must be duplicated in dependant code to correctly use the abstract Client class, which is needed when either a Producer or Consumer client could be the value of a class field. If no events are supplied to the Client class, then subscribing to event listeners doesn't work. When these types are duplicated in the dependant code and passed like _client?: Client<KafkaProducerEvents | KafkaConsumerEvents>, the event listener typings work correctly.

Exporting these types is the least effort to enable this usecase, otherwise requiring larger changes to how the abstract class is typed. One cannot say _client?: KafkaConsumer | Producer because then the event listener functions have conflicting types and cannot be used at all.

Without exported event types, they must be duplicated in dependant code to correctly use the abstract `Client` class.
@GaryWilber GaryWilber merged commit d336699 into Blizzard:master Jul 16, 2024
6 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