-
Notifications
You must be signed in to change notification settings - Fork 651
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
Auto-generated TypeScript service definition does not work with addService #1766
Labels
Comments
EduardoLaranjo
added a commit
to EduardoLaranjo/grpc-node
that referenced
this issue
May 4, 2021
relate to issue grpc#1766
Does not work on grpc other than @grpc/grpc-js.
|
What exactly are you trying to do, and what error are you getting? |
What is the error? That doesn't show any error. |
really?? |
Oh, I'm sorry, I didn't see that that error message was separate from the type definition information. I will look into fixing that. |
This has been fixed in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I recently started checking out gRPC and wanted to implement a basic client and server in TypeScript. This ultimately led me to the @grpc/proto-loader package. When generating the TypeScript typings for the service/proto, the service definition interface that was generated was incompatible with the
grpc.Server.addService
method. I'm currently using a protobuf service based on the "helloworld" example from the official gRPC repo.Problem description
The service definition interface generated by the
proto-loader-gen-types
utility is incompatible with theaddService
method of the gRPC server instance.The error given by the TypeScript compiler, in my case, is as follows:
Protobuf service definition (helloworld.proto):
Auto-generated service definition interface:
I was able to resolve the issue by manually modifying the service definition interface, extending
grpc.ServiceDefinition
, as follows:Reproduction steps
proto-loader-gen-types
utility to generate typings:Environment
The text was updated successfully, but these errors were encountered: