stephenh / ts-proto

An idiomatic protobuf generator for TypeScript
Apache License 2.0
2.13k stars 345 forks source link

`interface Rpc` not exported in service definition #1107

Open marcaddeo opened 1 month ago

marcaddeo commented 1 month ago

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.

stephenh commented 3 weeks ago

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!

marcaddeo commented 3 weeks ago

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