Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(): use class reference as injection token #5619

Closed
wants to merge 1 commit into from
Closed

fix(): use class reference as injection token #5619

wants to merge 1 commit into from

Conversation

tooleks
Copy link
Contributor

@tooleks tooleks commented Oct 28, 2020

For class providers use a class reference instead of a class name as an injection token to address dependency injection conflicts when two classes share the same name.

resolve #5591

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #5591

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[ ] No
[x] Not sure

Other information

N/A

For class providers use a class reference instead of a class name as an injection token to address dependency injection conflicts when two classes share the same name.

resolve #5591
@coveralls
Copy link

Pull Request Test Coverage Report for Build 33f7de29-66df-40d2-aa8c-e9db09bbccf1

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.001%) to 94.817%

Totals Coverage Status
Change from base Build 588ef383-4bdd-4add-926e-51e139d2b607: -0.001%
Covered Lines: 4921
Relevant Lines: 5190

💛 - Coveralls

metatype: DependencyTwo,
instance: Object.create(DependencyOne.prototype),
isResolved: false,
});
moduleDeps.providers.set('MainTest', mainTest);
moduleDeps.providers.set('DependencyOne', depOne);
moduleDeps.providers.set('DependencyTwo', depTwo);
moduleDeps.providers.set(DependencyOne, depOne);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about changing that test though

Shouldn't you keep it (as strings are still valid names) and add a new one that uses Functions ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right. I'll update the PR when will get a chance.

@kamilmysliwiec
Copy link
Member

@tooleks I've cherry-picked your PR and added a new one with other required additions/changes #6141

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dependency injector resolves dependencies using a class name instead of a class reference
4 participants