79373160

Date: 2025-01-21 04:02:24
Score: 0.5
Natty:
Report link

I used https://www.npmjs.com/package/ts-protoc-gen to generate typescript definition. In my case, I needed to pass in service=grpc-node param to the --ts_out. Then I got the correct file generated. xxx_grpc_pb.d.ts

My full command is sth like

protoc --proto_path={{path to proto files}} \
  --plugin=protoc-gen-ts={{path to ts-protoc-gen plugin}} \
  --plugin=protoc-gen-grpc={{path to grpc-tools plugin}} \
  --plugin={{path to official js plugin downloaded from https://github.com/protocolbuffers/protobuf-javascript release}} \
  --js_out=import_style=commonjs,binary:{{generated file path}} \
  --grpc_out=grpc_js:{{generated file path}} \
  --ts_out=service=grpc-node:{{generated file path}} \
Reasons:
  • Blacklisted phrase (0.5): I need
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: WU Chris