fix: correctly install implicit nested types dependencies#6800
fix: correctly install implicit nested types dependencies#6800arcanis merged 2 commits intoyarnpkg:masterfrom
Conversation
There was a problem hiding this comment.
Here you can see the impact of the fix :D All of these packages specified @types/react as dependency but yarn added an automatic @types/react when it didn't need to
There was a problem hiding this comment.
🤔 Can't tell if these being deps rather than peers is correct or not after a cursory look but this change is correct regardless -- if it is problematic then those are bugs that should be fixed upstream.
591a4d6 to
dbdd8ca
Compare
|
Any opinions on what changeset this should be? Strictly speaking, it could be considered a breaking change in behavior, but IMO it's is more accurately a minor? 🤔 The failing tests look like flakes unrelated to the changeset. |
|
I'd consider this a bugfix so patch should suffice |
dbdd8ca to
ef47d3b
Compare
|
@clemyan I've added a patch changeset following the interactive tool - let me know if you want any further changes! ❤️ |
|
Thanks @spanishpear ! |
What's the problem this PR addresses?
Closes #6442
By default - yarn will automatically add
@types/foofor a package, if the packagehas a peer dependency on
foo. This happens in thenormalizePackagecore,and exists as packages often don't specify the correct peer dependencies.
However, given a scenario where:
where
peer-deps-implicit-types-conflicthas 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.0is 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/foofor a package that hasfooas a peer-dependency, if the package already specifies@types/fooas a dependency.There is already logic for this behavior when it comes to
@types/already existing inpeerDependenciesorpeerDependenciesMeta- this PR just extends that todependenciesas well....
Checklist