Commit 73f0354
fix: correctly install implicit nested types dependencies (#6800)
## What's the problem this PR addresses?
Closes #6442
By default - yarn will automatically add `@types/foo` for a package, if
the package
has a peer dependency on `foo`. This happens in the `normalizePackage`
core,
and exists as packages often don't specify the correct peer
dependencies.
However, given a scenario where:
```json
"dependencies": {
"peer-deps-implicit-types-conflict": "1.0.0",
"@types/no-deps": "1.0.0",
}
```
where `peer-deps-implicit-types-conflict` has a dependency on
`@types/no-deps:2.0.0`,
```json
"dependencies": {
"@types/no-deps": "2.0.0"
},
"peerDependencies": {
"no-deps": "1.0.0"
}
```
yarn will only install `@types/no-deps:1.0.0` - even though
`@types/no-deps: 2.0.0` is specified
as 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 has
`foo` 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 in `peerDependencies` or `peerDependenciesMeta` - this
PR just extends that to `dependencies` as well.
...
## Checklist
<!--- Don't worry if you miss something, chores are automatically
tested. -->
<!--- This checklist exists to help you remember doing the chores when
you submit a PR. -->
<!--- Put an `x` in all the boxes that apply. -->
- [x] I have read the [Contributing
Guide](https://yarnpkg.com/advanced/contributing).
<!-- See
https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released
for more details. -->
<!-- Check with `yarn version check` and fix with `yarn version check
-i` -->
- [x] I have set the packages that need to be released for my changes to
be effective.
<!-- The "Testing chores" workflow validates that your PR follows our
guidelines. -->
<!-- If it doesn't pass, click on it to see details as to what your PR
might be missing. -->
- [x] I will check that all automated PR checks pass before the PR gets
reviewed.
---------
Co-authored-by: Maël Nison <[email protected]>1 parent 139617c commit 73f0354
File tree
6 files changed
+76
-6
lines changed- .yarn/versions
- packages
- acceptance-tests
- pkg-tests-fixtures/packages/peer-deps-implicit-types-conflict-1.0.0
- pkg-tests-specs/sources/features
- yarnpkg-core/sources
6 files changed
+76
-6
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
103 | 126 | | |
104 | 127 | | |
105 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1971 | 1971 | | |
1972 | 1972 | | |
1973 | 1973 | | |
1974 | | - | |
| 1974 | + | |
1975 | 1975 | | |
1976 | 1976 | | |
1977 | 1977 | | |
| |||
0 commit comments