chore(@nestjs/microservices) improve ClientGrpcProxy.getService typing

This commit is contained in:
Michael
2018-06-08 15:24:24 +02:00
parent 3ebec419fe
commit 89fe60a213
2 changed files with 2 additions and 2 deletions

View File

@@ -25,7 +25,7 @@ export class ClientGrpcProxy extends ClientProxy implements ClientGrpc {
this.grpcClient = this.createClient();
}
public getService<T = any>(name: string): T {
public getService<T extends {}>(name: keyof T): T {
const { options } = this.options as GrpcOptions;
if (!this.grpcClient[name]) {
throw new InvalidGrpcServiceException();

View File

@@ -1,3 +1,3 @@
export interface ClientGrpc {
getService<T = any>(name: string): T;
getService<T extends {}>(name: keyof T): T;
}