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(ClientReadableStream): Fixes return type generic argument of #30

Merged
merged 1 commit into from
Sep 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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