Incorrect typing of Struct.toJson()
CharlieMartell opened this issue · comments
Charlie Martell commented
Describe the bug
Here: https://github.com/bufbuild/protobuf-es/blob/main/packages/protobuf/src/google/protobuf/struct_pb.ts#L72 we see that this function returns a JsonValue type but in the implementation it should return a JsonObject type. This means consuming applications need get type errors when doing anything like Object.entries(struct.toJson())
Environment (please complete the following information):
- @connectrpc/connect-web version: 1.8.0
- Frontend framework and version: react@18
- Node.js version: node@20
- Browser and version: Chrome
Sri Krishna commented
Hey! Can you open the issue in https://github.com/bufbuild/protobuf-es? But the tl;dr answer is it is done for symmetry and will likely be solved alongside bufbuild/protobuf-es#508