Skip to content

fix: add generics to Binding type #604

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

Merged
merged 1 commit into from
Apr 2, 2025
Merged

Conversation

adtennant
Copy link
Contributor

@adtennant adtennant commented Apr 1, 2025

Proposed Changes

  • Add generics to the Binding type so that the typings of the values returned by binary and structured can be more exact.
  • Fix the typing on KafkaMessage so that T is authoritative of the type of value.

Fixes: #487

Description

The typing changes are not perfect, but they are closer to reality and backward compatible. They should remove a decent chunk of as casting in client code.

@adtennant adtennant force-pushed the main branch 4 times, most recently from 042546c to 4c81cd4 Compare April 1, 2025 16:10
Signed-off-by: Alex Tennant <atennant@skedulo.com>

Fixes: cloudevents#487
Signed-off-by: Alex Tennant <atennant@skedulo.com>
@lholmquist lholmquist merged commit f475cdf into cloudevents:main Apr 2, 2025
11 checks passed
@lholmquist
Copy link
Contributor

@adtennant Thanks for the contribution

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.

Return type definition of Kafka.structured seems incorrect
2 participants