Issue with message struct serialization/deserialization in method return type
Description:
I am encountering an issue when utilizing the google.protobuf.Struct message struct directly in the return type of a method in TypeScript generated by ts-proto. Instead of generating an object, the generated code uses the Struct class for encoding or decoding.
Steps to Reproduce:
- Define an RPC method as follows:
rpc Hello(HelloRequest) returns (google.protobuf.Struct);
- The corresponding TypeScript method looks like this:
Hello(request: HelloRequest): Observable<Struct>;
- When using this method, the generated code does not produce an
{ [key: string]: any }but relies on theStructclass.
Expected Behavior:
I expect the generated TypeScript code to produce an object for the return type instead of using the Struct class directly.
Actual Behavior:
The generated code uses the Struct class directly in the return type of the method.
Additional Information:
- Version of ts-proto used: 1.147.2
- TypeScript version: 5.2.2
- Arguments:
--ts_proto_opt=nestJs=true
Hi @ablause ; this sounds somewhat similar to the issue that was recently fixed in:
https://github.com/stephenh/ts-proto/pull/951
But that was for Value and this is for Structs...
I'm kinda guessing there, but if you could dig into that PR, and see if you could crib its approach (or at least it should get you to the right area of the code), and submit a PR for this, that'd be great! Thanks!