File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ export class Container {
115
115
service . instance = new ( type . bind . apply ( type , params ) ) ( ) ;
116
116
}
117
117
118
- this . applyPropertyHandlers ( type ) ;
118
+ this . applyPropertyHandlers ( type , service . instance ) ;
119
119
return service . instance as T ;
120
120
}
121
121
@@ -230,18 +230,13 @@ export class Container {
230
230
/**
231
231
* Applies all registered handlers on a given target class.
232
232
*/
233
- private static applyPropertyHandlers ( target : Function ) {
233
+ private static applyPropertyHandlers ( target : Function , instance : { [ key : string ] : any } ) {
234
234
this . handlers . forEach ( handler => {
235
- if ( handler . index ) return ;
235
+ if ( typeof handler . index === "number" ) return ;
236
236
if ( handler . object . constructor !== target && ! ( target . prototype instanceof handler . object . constructor ) )
237
237
return ;
238
238
239
- Object . defineProperty ( handler . object , handler . propertyName , {
240
- enumerable : true ,
241
- writable : true ,
242
- configurable : true ,
243
- value : handler . value ( )
244
- } ) ;
239
+ instance [ handler . propertyName ] = handler . value ( ) ;
245
240
} ) ;
246
241
}
247
242
You can’t perform that action at this time.
0 commit comments