@@ -80,7 +80,7 @@ export class Injector {
8080 }
8181 const loadInstance = ( instances : any [ ] ) => {
8282 targetWrapper . instance = targetWrapper . isDependencyTreeStatic ( )
83- ? new metatype ( ...instances )
83+ ? new ( metatype as Type < any > ) ( ...instances )
8484 : Object . create ( metatype . prototype ) ;
8585 } ;
8686 await this . resolveConstructorParams (
@@ -190,7 +190,7 @@ export class Injector {
190190 throw new RuntimeException ( ) ;
191191 }
192192 if ( instanceHost . isResolved ) {
193- return ;
193+ return done ( ) ;
194194 }
195195 const callback = async ( instances : any [ ] ) => {
196196 const properties = await this . resolveProperties (
@@ -235,10 +235,10 @@ export class Injector {
235235 return callback ( deps ) ;
236236 }
237237 const dependencies = isNil ( inject )
238- ? this . reflectConstructorParams ( wrapper . metatype )
238+ ? this . reflectConstructorParams ( wrapper . metatype as Type < any > )
239239 : inject ;
240240 const optionalDependenciesIds = isNil ( inject )
241- ? this . reflectOptionalParams ( wrapper . metatype )
241+ ? this . reflectOptionalParams ( wrapper . metatype as Type < any > )
242242 : [ ] ;
243243
244244 let isResolved = true ;
@@ -504,7 +504,7 @@ export class Injector {
504504 if ( metadata && contextId !== STATIC_CONTEXT ) {
505505 return this . loadPropertiesMetadata ( metadata , contextId , inquirer ) ;
506506 }
507- const properties = this . reflectProperties ( wrapper . metatype ) ;
507+ const properties = this . reflectProperties ( wrapper . metatype as Type < any > ) ;
508508 const instances = await Promise . all (
509509 properties . map ( async ( item : PropertyDependency ) => {
510510 try {
@@ -589,8 +589,11 @@ export class Injector {
589589
590590 if ( isNil ( inject ) && isInContext ) {
591591 instanceHost . instance = wrapper . forwardRef
592- ? Object . assign ( instanceHost . instance , new metatype ( ...instances ) )
593- : new metatype ( ...instances ) ;
592+ ? Object . assign (
593+ instanceHost . instance ,
594+ new ( metatype as Type < any > ) ( ...instances ) ,
595+ )
596+ : new ( metatype as Type < any > ) ( ...instances ) ;
594597 } else if ( isInContext ) {
595598 const factoryReturnValue = ( ( targetMetatype . metatype as any ) as Function ) (
596599 ...instances ,
0 commit comments