Skip to content

Commit 63e3940

Browse files
Merge pull request nestjs#1345 from nestjs/bugfix/1338-injection-scopes
bugfix(common) invalid metadata inheritance with custom providers
2 parents d25e6c7 + fe96bf6 commit 63e3940

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/common/decorators/core/inject.decorator.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ export function Inject<T = any>(token?: T) {
1515
token && isFunction(token) ? ((token as any) as Function).name : token;
1616

1717
if (!isUndefined(index)) {
18-
const dependencies =
18+
let dependencies =
1919
Reflect.getMetadata(SELF_DECLARED_DEPS_METADATA, target) || [];
2020

21-
dependencies.push({ index, param: type });
21+
dependencies = [...dependencies, { index, param: type }];
2222
Reflect.defineMetadata(SELF_DECLARED_DEPS_METADATA, dependencies, target);
2323
return;
2424
}
25-
const properties =
25+
let properties =
2626
Reflect.getMetadata(PROPERTY_DEPS_METADATA, target.constructor) || [];
2727

28-
properties.push({ key, type });
28+
properties = [...properties, { key, type }];
2929
Reflect.defineMetadata(
3030
PROPERTY_DEPS_METADATA,
3131
properties,

0 commit comments

Comments
 (0)