diff --git a/packages/grpc-js/src/index.ts b/packages/grpc-js/src/index.ts index 941174c01..5e7b8671f 100644 --- a/packages/grpc-js/src/index.ts +++ b/packages/grpc-js/src/index.ts @@ -35,6 +35,7 @@ import { Deserialize, loadPackageDefinition, makeClientConstructor, + MethodDefinition, Serialize, ServiceDefinition, } from './make-client'; @@ -230,6 +231,7 @@ export { ClientWritableStream, ClientDuplexStream, CallOptions, + MethodDefinition, StatusObject, ServiceError, ServerUnaryCall, diff --git a/packages/grpc-js/src/make-client.ts b/packages/grpc-js/src/make-client.ts index 99d40a649..e9e5ead9e 100644 --- a/packages/grpc-js/src/make-client.ts +++ b/packages/grpc-js/src/make-client.ts @@ -18,6 +18,7 @@ import { ChannelCredentials } from './channel-credentials'; import { ChannelOptions } from './channel-options'; import { Client } from './client'; +import { UntypedServiceImplementation } from './server'; export interface Serialize { (value: T): Buffer; @@ -49,9 +50,9 @@ export interface MethodDefinition extends ClientMethodDefinition, ServerMethodDefinition {} -export interface ServiceDefinition { +export type ServiceDefinition = { // tslint:disable-next-line no-any - [index: string]: MethodDefinition; + readonly [index in keyof ImplementationType]: MethodDefinition; } export interface ProtobufTypeDefinition {