ts-proto icon indicating copy to clipboard operation
ts-proto copied to clipboard

fix: only return Observable types for NestJS if the option is switched on

Open alexkb opened this issue 2 years ago • 4 comments

We're using --ts_proto_opt=nestjs=true and wanted to remove Observable's being returned, so we tried --ts_proto_opt=returnObservable=false but it had no effect.

This PR fixes that issue so it does behave as expected. If it is incorrect, then I suggest you update the documentation to make it clear that returnObservable has no effect when nestjs=true. Thanks.

alexkb avatar May 04 '23 08:05 alexkb

Bump on this, using nestJS currently doesn't allow me to generate methods returning a promise

tmthecoder avatar Oct 23 '23 02:10 tmthecoder

@tmthecoder if you've got --ts_proto_opt=nestJs=true set then you should get Promise's along with Observable's, which you don't have to use. You won't get them though, if you've also set ts_proto_opt=returnObservable=true OR if your methods involve streams. Whatever the case, I've just re-synced this branch with main but I'm not sure what the maintainer wants to do here sorry.

alexkb avatar Oct 23 '23 02:10 alexkb

@alexkb I see the types be promise or observable for the controller implementations but the clients only have observable in the definitions, not sure why that is. I have the observable flag set to false manually in the proto gen command

tmthecoder avatar Oct 23 '23 03:10 tmthecoder