Skip to content

Commit

Permalink
fix(resolvers): remove unusable asValue option of the factory decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
doktordirk committed May 30, 2018
1 parent f09ff03 commit 5739152
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/article/en-US/dependency-injection-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ If using TypeScript, keep in mind that `@autoinject` won't allow you to use `Res
* `all(key)`
* `optional(checkParent?)`
* `parent`
* `factory(key, asValue?)`
* `factory(key)`
* `newInstance(asKey?, dynamicDependencies: [any])`

Here's an example of how we might express a dependency on `HttpClient` that we may or may not actually need to use, depending on runtime scenarios:
Expand Down
5 changes: 2 additions & 3 deletions src/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,10 @@ export function parent(target, key, index) {
/**
* Decorator: Specifies the dependency to create a factory method, that can accept optional arguments
*/
export function factory(keyValue: any, asValue?: any) {
export function factory(keyValue: any) {
return function(target, key, index) {
let inject = getDecoratorDependencies(target);
let factory = Factory.of(keyValue);
inject[index] = asValue ? factory.as(asValue) : factory;
inject[index] = Factory.of(keyValue);
};
}

Expand Down

0 comments on commit 5739152

Please sign in to comment.