fix: correctly install implicit nested types dependencies #6800
+74
−6
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.
What's the problem this PR addresses?
Closes #6442
By default - yarn will automatically add
@types/foo
for a package, if the packagehas a peer dependency on
foo
. This happens in thenormalizePackage
core,and exists as packages often don't specify the correct peer dependencies.
However, given a scenario where:
where
peer-deps-implicit-types-conflict
has a dependency on@types/no-deps:2.0.0
,yarn will only install
@types/no-deps:1.0.0
- even though@types/no-deps: 2.0.0
is specifiedas a dependency!
How did you fix it?
The fix is rather trivial and thanks to the helpful comment here - #6442 (comment) - simply don't install the automatic
@types/foo
for a package that hasfoo
as a peer-dependency, if the package already specifies@types/foo
as a dependency.There is already logic for this behavior when it comes to
@types/
already existing inpeerDependencies
orpeerDependenciesMeta
- this PR just extends that todependencies
as well....
Checklist