-
Notifications
You must be signed in to change notification settings - Fork 853
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
Combine RpcResponseTransformer
and RpcResponseTransformerFor
#3162
Combine RpcResponseTransformer
and RpcResponseTransformerFor
#3162
Conversation
|
26f7290
to
800d312
Compare
dcb68fd
to
2a3aa2f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge activity
|
2a3aa2f
to
48fa39a
Compare
Because there has been no activity on this PR for 14 days since it was merged, it has been automatically locked. Please open a new issue if it requires a follow up. |
This PR combines the
RpcResponseTransformer
andRpcResponseTransformerFor
types by using an optional type parameter.Initially,
RpcResponseTransformer
was defining a generic function (as opposed to a generic type that applies its type parameter to the function). However, this was only needed in therpc-api
file to do:The same can be achieved using:
Without loosening any types as
config.responseTransformer<T>
was equivalent to a type-cast.This makes it less tedious to define response transformers as we don't have to always cast our return type to an abstract type
T
even when we know the real return type.