connectrpc / connect-es

The TypeScript implementation of Connect: Protobuf RPC that works.

Home Page:https://connectrpc.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect typing of Struct.toJson()

CharlieMartell opened this issue · comments

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

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