Skip to content

Commit

Permalink
fix: add serviceName to grpc-js client constructor type (#980)
Browse files Browse the repository at this point in the history
* fix: add serviceName to grpc-js client constructor type

* Re-codegen.

---------

Co-authored-by: Stephen Haberman <[email protected]>
  • Loading branch information
le0nik and stephenh authored Dec 26, 2023
1 parent 4c94318 commit 2c6682d
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export interface TestClient extends Client {
export const TestClient = makeGenericClientConstructor(TestService, "simple.Test") as unknown as {
new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): TestClient;
service: typeof TestService;
serviceName: string;
};

type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export interface TestClient extends Client {
export const TestClient = makeGenericClientConstructor(TestService, "simple.Test") as unknown as {
new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): TestClient;
service: typeof TestService;
serviceName: string;
};

type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
Expand Down
1 change: 1 addition & 0 deletions integration/grpc-js-use-date-true/grpc-js-use-date-true.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export interface TestClient extends Client {
export const TestClient = makeGenericClientConstructor(TestService, "simple.Test") as unknown as {
new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): TestClient;
service: typeof TestService;
serviceName: string;
};

type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
Expand Down
1 change: 1 addition & 0 deletions integration/grpc-js/simple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ export interface TestClient extends Client {
export const TestClient = makeGenericClientConstructor(TestService, "simple.Test") as unknown as {
new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): TestClient;
service: typeof TestService;
serviceName: string;
};

type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
Expand Down
1 change: 1 addition & 0 deletions src/generate-grpc-js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ function generateClientConstructor(fileDesc: FileDescriptorProto, serviceDesc: S
options?: Partial<${ClientOptions}>,
): ${serviceDesc.name}Client;
service: typeof ${serviceDesc.name}Service;
serviceName: string;
}
`;
}

0 comments on commit 2c6682d

Please sign in to comment.