Permalink
Browse files

fix(dependency-injection): adjust based on review

Fixes #171
  • Loading branch information...
silbinarywolf committed Dec 13, 2018
1 parent ac4e6f9 commit dc756f443150bb96a2ef3aa67692b888e6f629fd
Showing with 5 additions and 7 deletions.
  1. +5 −7 src/injection.js
@@ -8,13 +8,11 @@ export function autoinject(potentialTarget?: any): any {
let deco = function(target) {
if (!target.hasOwnProperty('inject')) {
target.inject = (metadata.getOwn(metadata.paramTypes, target) || _emptyParameters).slice();
if (target.inject &&
target.inject.length > 0) {
// TypeScript 3.0 metadata for "...rest" gives type "Object"
// if last parameter is "Object", assume it's a ...rest and remove that metadata.
if (target.inject[target.inject.length - 1] === Object) {
target.inject.splice(-1,1);
}
// TypeScript 3.0 metadata for "...rest" gives type "Object"
// if last parameter is "Object", assume it's a ...rest and remove that metadata.
if (target.inject.length > 0 &&
target.inject[target.inject.length - 1] === Object) {
target.inject.pop();
}
}
};

0 comments on commit dc756f4

Please sign in to comment.