Fix missing TypeScript return type for `serverStreaming` calls. (#1167)

* Add strongly types to MethodDescriptor constructor
* Adds return type declaration to server streaming call

Co-authored-by: Eryu Xia <eryu@google.com>
This commit is contained in:
Lukas Möller 2021-11-20 00:15:34 +01:00 committed by GitHub
parent 97baed4dbe
commit 6b1d1e97a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -619,7 +619,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,

View File

@ -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,
@ -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> {