@@ -30,14 +30,12 @@ export class ServerGrpc extends Server implements CustomTransportStrategy {
3030 private readonly url : string ;
3131 private grpcClient : any ;
3232
33- constructor ( private readonly options : MicroserviceOptions [ 'options' ] ) {
33+ constructor ( private readonly options : GrpcOptions [ 'options' ] ) {
3434 super ( ) ;
35- this . url =
36- this . getOptionsProp < GrpcOptions > ( options , 'url' ) || GRPC_DEFAULT_URL ;
35+ this . url = this . getOptionsProp ( options , 'url' ) || GRPC_DEFAULT_URL ;
3736
3837 const protoLoader =
39- this . getOptionsProp < GrpcOptions > ( options , 'protoLoader' ) ||
40- GRPC_DEFAULT_PROTO_LOADER ;
38+ this . getOptionsProp ( options , 'protoLoader' ) || GRPC_DEFAULT_PROTO_LOADER ;
4139
4240 grpcPackage = this . loadPackage ( 'grpc' , ServerGrpc . name , ( ) =>
4341 require ( 'grpc' ) ,
@@ -58,10 +56,7 @@ export class ServerGrpc extends Server implements CustomTransportStrategy {
5856
5957 public async bindEvents ( ) {
6058 const grpcContext = this . loadProto ( ) ;
61- const packageName = this . getOptionsProp < GrpcOptions > (
62- this . options ,
63- 'package' ,
64- ) ;
59+ const packageName = this . getOptionsProp ( this . options , 'package' ) ;
6560 const grpcPkg = this . lookupPackage ( grpcContext , packageName ) ;
6661 if ( ! grpcPkg ) {
6762 const invalidPackageError = new InvalidGrpcPackageException ( ) ;
@@ -165,21 +160,18 @@ export class ServerGrpc extends Server implements CustomTransportStrategy {
165160
166161 public createClient ( ) : any {
167162 const server = new grpcPackage . Server ( {
168- 'grpc.max_send_message_length' : this . getOptionsProp < GrpcOptions > (
163+ 'grpc.max_send_message_length' : this . getOptionsProp (
169164 this . options ,
170165 'maxSendMessageLength' ,
171166 GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH ,
172167 ) ,
173- 'grpc.max_receive_message_length' : this . getOptionsProp < GrpcOptions > (
168+ 'grpc.max_receive_message_length' : this . getOptionsProp (
174169 this . options ,
175170 'maxReceiveMessageLength' ,
176171 GRPC_DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH ,
177172 ) ,
178173 } ) ;
179- const credentials = this . getOptionsProp < GrpcOptions > (
180- this . options ,
181- 'credentials' ,
182- ) ;
174+ const credentials = this . getOptionsProp ( this . options , 'credentials' ) ;
183175 server . bind (
184176 this . url ,
185177 credentials || grpcPackage . ServerCredentials . createInsecure ( ) ,
@@ -198,8 +190,8 @@ export class ServerGrpc extends Server implements CustomTransportStrategy {
198190
199191 public loadProto ( ) : any {
200192 try {
201- const file = this . getOptionsProp < GrpcOptions > ( this . options , 'protoPath' ) ;
202- const loader = this . getOptionsProp < GrpcOptions > ( this . options , 'loader' ) ;
193+ const file = this . getOptionsProp ( this . options , 'protoPath' ) ;
194+ const loader = this . getOptionsProp ( this . options , 'loader' ) ;
203195
204196 const packageDefinition = grpcProtoLoaderPackage . loadSync ( file , loader ) ;
205197 const packageObject = grpcPackage . loadPackageDefinition (
0 commit comments