In grpc-js, at least according to the GRPC.io docs, I can do things like this:
client.sayGoodNight({name: 'Gracie'}, ... );
But with the Typescript version that doesn't seem to be possible; instead, I need to create a HelloRequest object explicitly and set the name:
const request = new GoodNightRequest()
request.setName('Gracie')
client.sayGoodNight(request, ... )
Personally I'm irked by both the mutable state and the boilerplate of the setter syntax and strongly prefer the object-literal {name: 'Gracie'} version. (For me that's most of the fun of writing Javascript!) Does, or could, this library support that streamlined syntax? I see that GoodNightRequest.AsObject in good_night_pb.d.ts actually does define the necessary interface, but it doesn't look like sayGoodNight will accept anything but an instance of the GoodNightRequest class.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
In grpc-js, at least according to the GRPC.io docs, I can do things like this:
But with the Typescript version that doesn't seem to be possible; instead, I need to create a
HelloRequest
object explicitly and set the name:Personally I'm irked by both the mutable state and the boilerplate of the setter syntax and strongly prefer the object-literal
{name: 'Gracie'}
version. (For me that's most of the fun of writing Javascript!) Does, or could, this library support that streamlined syntax? I see thatGoodNightRequest.AsObject
ingood_night_pb.d.ts
actually does define the necessary interface, but it doesn't look likesayGoodNight
will accept anything but an instance of theGoodNightRequest
class.