stephenh / ts-proto

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

grpc-js dependency #306

Closed jsbrain closed 3 years ago

jsbrain commented 3 years ago

So for me generating the types with --ts_proto_opt=outputServices=grpc-js apparently changes the output stubs, but still imports e.g. the Metadata etc. dependencies from grpc but shouldn't it include them from @grpc/grpc-js instead?

So I expect

import { Metadata } from '@grpc/grpc-js';

but I got

import { Metadata } from 'grpc';

so I guess that's probably a bug?

jsbrain commented 3 years ago

Ok I just realized that there are already tests for it and it works when just using that option but I'm actually using it like this

protoc --plugin=../node_modules/.bin/protoc-gen-ts_proto \
  --ts_proto_opt=nestJs=true,esModuleInterop=true \
  --ts_proto_opt=addGrpcMetadata=true \
  --ts_proto_opt=outputServices=grpc-js \
  --ts_proto_out=. "${proto_files[@]}"

after after a quick test I realized it doesn't work in combination with --ts_proto_opt=nestJs=true which might was intentional but actually NestJS will switch to grpc-js in v8 so those options should probably work together in the future 🥳

stephenh commented 3 years ago

:tada: This issue has been resolved in version 1.82.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: