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

feat(core): support optional dependencies in factory providers #9227

Merged
merged 3 commits into from
Mar 1, 2022

Conversation

kamilmysliwiec
Copy link
Member

@kamilmysliwiec kamilmysliwiec commented Feb 18, 2022

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • 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: N/A

What is the new behavior?

Introduces a new optional factory provider dependencies syntax:

providers: [
  {
    provide: 'FACTORY_PROVIDER',
    useFactory: optionalDependency => optionalDependency ?? defaultValue,
    inject: [{ token: 'RANDOM_OPTIONAL_DEP', optional: true }], // <- this is new 🔥 
  },
  { provide: 'RANDOM_OPTIONAL_DEP', useValue: 'OPTIONAL_DEP_VALUE' },
],

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@coveralls
Copy link

coveralls commented Feb 18, 2022

Pull Request Test Coverage Report for Build 833a9586-e3d4-4777-8dd0-27fb96ec52c4

  • 20 of 20 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 94.172%

Totals Coverage Status
Change from base Build 0c6ff061-43cb-4dba-bbee-5da440fdbcd6: 0.02%
Covered Lines: 5736
Relevant Lines: 6091

💛 - Coveralls

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

Successfully merging this pull request may close these issues.

3 participants