grpc/grpc-node

Possible duplicates of function declarations in service interface

danielronnkvist opened this issue · 0 comments

Problem description

This is an issue with generateServiceClientInterface in proto-loader-gen-types.ts. If the methodName already is in camelCase the generated interface will have duplicate function overloads in the interface.

https://github.com/grpc/grpc-node/blob/cfa80720995d39e50b08d33efbd90e8a93a35a57/packages/proto-loader/bin/proto-loader-gen-types.ts#L558C1-L558C62

Reproduction steps

With a proto file like this:

service Greeter {
  // Sends a greeting
  rpc sayHello (HelloRequest) returns (HelloReply) {}
}

// The request message containing the user's name.
message HelloRequest {
  string name = 1;
}

// The response message containing the greetings
message HelloReply {
  string message = 1;
}

proto-loader-gen-types will generate a service interface like this one:

export interface GreeterClient extends grpc.Client {
  /**
   * Sends a greeting
   */
  sayHello(argument: I_google_showcase_v1beta1_HelloRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<O_google_showcase_v1beta1_HelloReply>): grpc.ClientUnaryCall;
  sayHello(argument: I_google_showcase_v1beta1_HelloRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<O_google_showcase_v1beta1_HelloReply>): grpc.ClientUnaryCall;
  sayHello(argument: I_google_showcase_v1beta1_HelloRequest, options: grpc.CallOptions, callback: grpc.requestCallback<O_google_showcase_v1beta1_HelloReply>): grpc.ClientUnaryCall;
  sayHello(argument: I_google_showcase_v1beta1_HelloRequest, callback: grpc.requestCallback<O_google_showcase_v1beta1_HelloReply>): grpc.ClientUnaryCall;
  /**
   * Sends a greeting
   */
  sayHello(argument: I_google_showcase_v1beta1_HelloRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<O_google_showcase_v1beta1_HelloReply>): grpc.ClientUnaryCall;
  sayHello(argument: I_google_showcase_v1beta1_HelloRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<O_google_showcase_v1beta1_HelloReply>): grpc.ClientUnaryCall;
  sayHello(argument: I_google_showcase_v1beta1_HelloRequest, options: grpc.CallOptions, callback: grpc.requestCallback<O_google_showcase_v1beta1_HelloReply>): grpc.ClientUnaryCall;
  sayHello(argument: I_google_showcase_v1beta1_HelloRequest, callback: grpc.requestCallback<O_google_showcase_v1beta1_HelloReply>): grpc.ClientUnaryCall;
  
}

Environment

  • OS name, version and architecture: Mac Sonoma version 14.3, Apple M1 Max
  • Node version 20.11.0
  • Node installation method: nvm
  • Package name and version @grpc/proto-loader@0.7.10