grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.45k stars 761 forks source link

TypeScript client method signatures should mark metadata as optional #1368

Closed andrewmbenton closed 8 months ago

andrewmbenton commented 9 months ago

This is an inverse issue to https://github.com/grpc/grpc-web/issues/408

There are a couple of method signatures in the generated TypeScript client that should mark the metadata parameter as optional, to reduce explicitly passing unnecessary null values:

https://github.com/grpc/grpc-web/blob/0ec55aaad784e114bcb391b0b33ac4fd2e83e3f2/javascript/net/grpc/web/generator/grpc_generator.cc#L652-L655

https://github.com/grpc/grpc-web/blob/0ec55aaad784e114bcb391b0b33ac4fd2e83e3f2/javascript/net/grpc/web/generator/grpc_generator.cc#L670-L674

Making the metadata parameter optional in the method returning a Promise would bring the TypeScript client closer in line with the PromiseClient interface available when generating with import_style=commonjs+dts.