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(common): disallow usage of inject on class and value providers at type level #9383

Merged
merged 1 commit into from May 17, 2022

Conversation

micalevisk
Copy link
Member

@micalevisk micalevisk commented Mar 25, 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: closes #9357

What is the new behavior?

At build time, we can no longer have the option inject when writing a class or value providers

image

The TS error would be like this:

Type '{ provide: string; useValue: number; inject: never[]; }' is not assignable to type 'Provider<any>'.
  Object literal may only specify known properties, and 'useValue' does not exist in type 'FactoryProvider<any>'.

Does this PR introduce a breaking change?

  • Yes
  • No

This will break the build step of projects that are using the inject value when defining a class or a value provider even tho this option does nothing on these providers.

Copy link
Member

@jmcdo29 jmcdo29 left a comment

Choose a reason for hiding this comment

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

Looks go to me. I think we'll have to wait for v9 so that we don't break anyone's build until the major bump

@micalevisk micalevisk changed the title feat(common)!: disallow usage of inject on class and value providers feat(common)!: disallow usage of inject on class and value providers at type level Mar 25, 2022
@coveralls
Copy link

Pull Request Test Coverage Report for Build a702be58-22bb-4c44-af07-7c0fba684d21

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.001%) to 94.119%

Totals Coverage Status
Change from base Build f4e63af7-2696-4bb6-ba31-785c7b9652df: -0.001%
Covered Lines: 5761
Relevant Lines: 6121

💛 - Coveralls

@kamilmysliwiec kamilmysliwiec added this to the 9.0.0 milestone May 13, 2022
@kamilmysliwiec kamilmysliwiec changed the base branch from master to 9.0.0 May 17, 2022 11:13
@kamilmysliwiec kamilmysliwiec merged commit ca967b8 into nestjs:9.0.0 May 17, 2022
@micalevisk micalevisk deleted the fix-issue-9357 branch May 17, 2022 11:40
@kamilmysliwiec kamilmysliwiec mentioned this pull request May 20, 2022
12 tasks
@micalevisk micalevisk changed the title feat(common)!: disallow usage of inject on class and value providers at type level feat(common): disallow usage of inject on class and value providers at type level May 25, 2022
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.

Usage of TS Discriminated Union for Provider type
5 participants