stephenh / ts-proto

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

returnObservable option not being honored #157

Closed tonyneel923 closed 3 years ago

tonyneel923 commented 3 years ago

When I pass returnObservable=false into the options flag it still uses observable.

Example command:

protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt=returnObservable=false,outputEncodeMethods=false,outputJsonMethods=false,outputClientImpl=false --ts_proto_out=typescript ${path}

tonyneel923 commented 3 years ago

After more digging this only happens when return types use stream. Is there any wah to not use an external lib to represent stream in typescript? Sorry new to grpc so not sure.

stephenh commented 3 years ago

@tonyneel923 "not use an external lib to represent stream" right, there is not a built-in stream type, so we have to pull in a 3rd party library. Also since ts-proto just does codegen, it's not ts-proto really deciding whether to use rxjs or not, it's the nestjs and/or grpc-web runtimes that choose what streaming library they use, and then ts-proto just outputs code that uses the appropriate type.