mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
chore(@nestjs/microservices) improve ClientGrpcProxy.getService typing
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export interface ClientGrpc {
|
||||
getService<T = any>(name: string): T;
|
||||
getService<T extends {}>(name: keyof T): T;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user