Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing TypeScript return type for serverStreaming calls. #1167

Merged
6 changes: 4 additions & 2 deletions javascript/net/grpc/web/generator/grpc_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,8 @@ void PrintTypescriptFile(Printer* printer, const FileDescriptor* file,
: "grpcWeb.MethodType.UNARY";
if (!method->client_streaming()) {
printer->Print(vars,
"methodDescriptor$method_name$ = "
"methodDescriptor$method_name$: "
"grpcWeb.MethodDescriptor<$input_type$, $output_type$> = "
"new grpcWeb.MethodDescriptor(\n");
printer->Indent();
printer->Print(vars,
Expand All @@ -619,7 +620,8 @@ void PrintTypescriptFile(Printer* printer, const FileDescriptor* file,
printer->Indent();
printer->Print(vars,
"request: $input_type$,\n"
"metadata?: grpcWeb.Metadata) {\n");
"metadata?: grpcWeb.Metadata): "
"grpcWeb.ClientReadableStream<$output_type$> {\n");
printer->Print(vars, "return this.client_.serverStreaming(\n");
printer->Indent();
printer->Print(vars,
Expand Down
12 changes: 6 additions & 6 deletions packages/grpc-web/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ declare module "grpc-web" {

export class MethodDescriptor<REQ, RESP> {
constructor(name: string,
methodType: any,
requestType: any,
responseType: any,
methodType: string,
requestType: new (...args: unknown[]) => REQ,
responseType: new (...args: unknown[]) => RESP,
requestSerializeFn: any,
responseDeserializeFn: any);
createRequest(requestMessage: REQ,
Expand All @@ -83,10 +83,10 @@ declare module "grpc-web" {
status?: Status): UnaryResponse<REQ, RESP>;
getName(): string;
getMethodType(): string;
getResponseMessageCtor(): any;
getRequestMessageCtor(): any;
getResponseDeserializeFn(): any;
getRequestMessageCtor(): new (...args: unknown[]) => REQ;
getResponseMessageCtor(): new (...args: unknown[]) => RESP;
getRequestSerializeFn(): any;
getResponseDeserializeFn(): any;
}

export class Request<REQ, RESP> {
Expand Down