ts-proto icon indicating copy to clipboard operation
ts-proto copied to clipboard

`interface Rpc` not exported in service definition

Open marcaddeo opened this issue 1 year ago • 2 comments

When I generate a service the Rpc interface is not exported, should it be?

interface Rpc {
  request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
}

I'm trying to implement it as a custom rpc to pass to my ServiceClientImpl that is generated, but since it's not exported I have to edit the file to add export.

marcaddeo avatar Sep 14 '24 20:09 marcaddeo

Hi @marcaddeo ! Apologies for the late reply, I have to batch when I triage ts-proto issues...

I'm not sure why we haven't exported Rpc, but that makes sense; if you'd like to submit a PR, that would be amazing, the code is around in here:

https://github.com/stephenh/ts-proto/blob/main/src/generate-services.ts#L459

Or here if you're using grpc-web:

https://github.com/stephenh/ts-proto/blob/main/src/generate-grpc-web.ts#L176

Thanks!

stephenh avatar Sep 29 '24 14:09 stephenh

@stephenh no worries! Was easy enough to just patch that after codegen in the interim. PR submitted.

marcaddeo avatar Sep 30 '24 12:09 marcaddeo