Skip to content

Commit

Permalink
Merge pull request #30 from zakhenry/fix/client-readable-stream
Browse files Browse the repository at this point in the history
fix(ClientReadableStream): Fixes return type generic argument of
  • Loading branch information
agreatfool authored Sep 21, 2018
2 parents 9e40472 + c85c3a7 commit f7fe872
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 44 deletions.
10 changes: 5 additions & 5 deletions build/lib/template/svc_tsd.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export interface I{{{serviceName}}}Client {
{{lcFirst methodName}}(metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: Error | null, response: {{{responseTypeName}}}) => void): grpc.ClientWritableStream<{{{requestTypeName}}}>;
{{/eq}}
{{#eq type "ClientReadableStream"}}
{{lcFirst methodName}}(request: {{{requestTypeName}}}, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<{{{requestTypeName}}}>;
{{lcFirst methodName}}(request: {{{requestTypeName}}}, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<{{{requestTypeName}}}>;
{{lcFirst methodName}}(request: {{{requestTypeName}}}, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<{{{responseTypeName}}}>;
{{lcFirst methodName}}(request: {{{requestTypeName}}}, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<{{{responseTypeName}}}>;
{{/eq}}
{{#eq type "ClientDuplexStream"}}
{{lcFirst methodName}}(): grpc.ClientDuplexStream<{{{requestTypeName}}}, {{{responseTypeName}}}>;
Expand All @@ -85,13 +85,13 @@ export class {{{serviceName}}}Client extends grpc.Client implements I{{{serviceN
public {{lcFirst methodName}}(metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: Error | null, response: {{{responseTypeName}}}) => void): grpc.ClientWritableStream<{{{requestTypeName}}}>;
{{/eq}}
{{#eq type "ClientReadableStream"}}
public {{lcFirst methodName}}(request: {{{requestTypeName}}}, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<{{{requestTypeName}}}>;
public {{lcFirst methodName}}(request: {{{requestTypeName}}}, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<{{{requestTypeName}}}>;
public {{lcFirst methodName}}(request: {{{requestTypeName}}}, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<{{{responseTypeName}}}>;
public {{lcFirst methodName}}(request: {{{requestTypeName}}}, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<{{{responseTypeName}}}>;
{{/eq}}
{{#eq type "ClientDuplexStream"}}
public {{lcFirst methodName}}(options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<{{{requestTypeName}}}, {{{responseTypeName}}}>;
public {{lcFirst methodName}}(metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<{{{requestTypeName}}}, {{{responseTypeName}}}>;
{{/eq}}
{{/each}}
}
{{/each}}
{{/each}}
2 changes: 1 addition & 1 deletion examples/build/client.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions examples/build/proto/book_grpc_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export interface IBookServiceClient {
getBook(request: book_pb.GetBookRequest, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientUnaryCall;
getBook(request: book_pb.GetBookRequest, metadata: grpc.Metadata, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientUnaryCall;
getBook(request: book_pb.GetBookRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientUnaryCall;
getBooksViaAuthor(request: book_pb.GetBookViaAuthor, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<book_pb.GetBookViaAuthor>;
getBooksViaAuthor(request: book_pb.GetBookViaAuthor, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<book_pb.GetBookViaAuthor>;
getBooksViaAuthor(request: book_pb.GetBookViaAuthor, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<book_pb.Book>;
getBooksViaAuthor(request: book_pb.GetBookViaAuthor, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<book_pb.Book>;
getGreatestBook(callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientWritableStream<book_pb.GetBookRequest>;
getGreatestBook(metadata: grpc.Metadata, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientWritableStream<book_pb.GetBookRequest>;
getGreatestBook(options: Partial<grpc.CallOptions>, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientWritableStream<book_pb.GetBookRequest>;
Expand All @@ -79,8 +79,8 @@ export class BookServiceClient extends grpc.Client implements IBookServiceClient
public getBook(request: book_pb.GetBookRequest, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientUnaryCall;
public getBook(request: book_pb.GetBookRequest, metadata: grpc.Metadata, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientUnaryCall;
public getBook(request: book_pb.GetBookRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientUnaryCall;
public getBooksViaAuthor(request: book_pb.GetBookViaAuthor, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<book_pb.GetBookViaAuthor>;
public getBooksViaAuthor(request: book_pb.GetBookViaAuthor, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<book_pb.GetBookViaAuthor>;
public getBooksViaAuthor(request: book_pb.GetBookViaAuthor, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<book_pb.Book>;
public getBooksViaAuthor(request: book_pb.GetBookViaAuthor, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<book_pb.Book>;
public getGreatestBook(callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientWritableStream<book_pb.GetBookRequest>;
public getGreatestBook(metadata: grpc.Metadata, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientWritableStream<book_pb.GetBookRequest>;
public getGreatestBook(options: Partial<grpc.CallOptions>, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientWritableStream<book_pb.GetBookRequest>;
Expand Down
30 changes: 15 additions & 15 deletions examples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const getBooksViaAuthor = (author: string) => {

log(`[getBooksViaAuthor] Request: ${JSON.stringify(request.toObject())}`);

const stream: grpc.ClientReadableStream<GetBookViaAuthor> = client.getBooksViaAuthor(request);
const stream: grpc.ClientReadableStream<Book> = client.getBooksViaAuthor(request);
stream.on("data", (data: Book) => {
log(`[getBooksViaAuthor] Book: ${JSON.stringify(data.toObject())}`);
});
Expand Down
8 changes: 4 additions & 4 deletions examples/src/proto/book_grpc_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export interface IBookServiceClient {
getBook(request: book_pb.GetBookRequest, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientUnaryCall;
getBook(request: book_pb.GetBookRequest, metadata: grpc.Metadata, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientUnaryCall;
getBook(request: book_pb.GetBookRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientUnaryCall;
getBooksViaAuthor(request: book_pb.GetBookViaAuthor, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<book_pb.GetBookViaAuthor>;
getBooksViaAuthor(request: book_pb.GetBookViaAuthor, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<book_pb.GetBookViaAuthor>;
getBooksViaAuthor(request: book_pb.GetBookViaAuthor, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<book_pb.Book>;
getBooksViaAuthor(request: book_pb.GetBookViaAuthor, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<book_pb.Book>;
getGreatestBook(callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientWritableStream<book_pb.GetBookRequest>;
getGreatestBook(metadata: grpc.Metadata, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientWritableStream<book_pb.GetBookRequest>;
getGreatestBook(options: Partial<grpc.CallOptions>, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientWritableStream<book_pb.GetBookRequest>;
Expand All @@ -79,8 +79,8 @@ export class BookServiceClient extends grpc.Client implements IBookServiceClient
public getBook(request: book_pb.GetBookRequest, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientUnaryCall;
public getBook(request: book_pb.GetBookRequest, metadata: grpc.Metadata, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientUnaryCall;
public getBook(request: book_pb.GetBookRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientUnaryCall;
public getBooksViaAuthor(request: book_pb.GetBookViaAuthor, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<book_pb.GetBookViaAuthor>;
public getBooksViaAuthor(request: book_pb.GetBookViaAuthor, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<book_pb.GetBookViaAuthor>;
public getBooksViaAuthor(request: book_pb.GetBookViaAuthor, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<book_pb.Book>;
public getBooksViaAuthor(request: book_pb.GetBookViaAuthor, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<book_pb.Book>;
public getGreatestBook(callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientWritableStream<book_pb.GetBookRequest>;
public getGreatestBook(metadata: grpc.Metadata, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientWritableStream<book_pb.GetBookRequest>;
public getGreatestBook(options: Partial<grpc.CallOptions>, callback: (error: Error | null, response: book_pb.Book) => void): grpc.ClientWritableStream<book_pb.GetBookRequest>;
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Generate d.ts definitions for generated js files from grpc_tools_node_protoc",
"main": "build/index.js",
"scripts": {
"build": "tsc -p .",
"build": "tsc -p . && cp -r src/lib/template build/lib",
"test": "echo \"Error: no test specified\" && exit 1"
},
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ExportMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ export class ExportMap {
getEnum(str: string): ExportEnumEntry | undefined {
return this.enumMap[str];
}
}
}
Loading

0 comments on commit f7fe872

Please sign in to comment.