-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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(core): false-positive value provider not registered error when the value is undefined
#11129
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pull Request Test Coverage Report for Build 0775c6b8-444f-4776-815d-b5a9141e8b88
💛 - Coveralls |
Tony133
suggested changes
Feb 17, 2023
tonivj5
reviewed
Feb 18, 2023
micalevisk
changed the title
fix(core): false-positive provider value provider not found when the value is
fix(core): false-negative value provider not registereing when the value is Feb 18, 2023
undefined
undefined
micalevisk
changed the title
fix(core): false-negative value provider not registereing when the value is
fix(core): false-negative value provider not registered when the value is Feb 18, 2023
undefined
undefined
micalevisk
changed the title
fix(core): false-negative value provider not registered when the value is
fix(core): false-negative value provider not registered error when the value is Feb 18, 2023
undefined
undefined
micalevisk
changed the title
fix(core): false-negative value provider not registered error when the value is
fix(core): false-positive value provider not registered error when the value is Feb 19, 2023
undefined
undefined
when the value of the provider is `undefined`
This was referenced May 24, 2024
This was referenced Sep 7, 2024
This was referenced Sep 24, 2024
This was referenced Sep 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
when exporting some custom value provider that was registered with the value
undefined
we got the following errorWhat is the new behavior?
We could now have mandatory custom provider values with the value
undefined
. Although this unlikely make sense, it's aligned with the present behavior of factory providers that could returnundefined
I find this bug when trying to help one dev on our Discord. He was importing some value from a 3rd-party package and that value was used at the
useValue
. Later he find out that the import clause was wrong (named import vs namespace import), so that has nothing to do with the error raised by nestjs internals. Thus, that error was a false-positive signal on provider not registered within the module.Does this PR introduce a breaking change?
This has implications on circular file imports because in the current version they are caught at bootstrapping time, while after this PR they won't lead to any injection error (given that case). So you should consider this trade-off.
Another solution would be improving that error message to give a hint that the value of the provider might be
undefined
and suggesting the use ofoptional: true
flag.