Skip to content

Commit

Permalink
fix: typescript react type resolution in monorepos (#2866)
Browse files Browse the repository at this point in the history
Monorepos with potentially multiple versions of @types/react
might resolve the wrong @types/react from within Eufemia

With @types/react and @types/react-dom as optional peerDependencies
the package manager is able to link the original types package
from the app into Eufemia
  • Loading branch information
thebreiflabb authored Nov 8, 2023
1 parent 13beec9 commit 44f04f3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/dnb-eufemia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,19 @@
"what-input": "5.2.10"
},
"peerDependencies": {
"@types/react": "^17 || ^18",
"@types/react-dom": "^17 || ^18",
"react": "^17 || ^18",
"react-dom": "^17 || ^18"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
},
"devDependencies": {
"@babel/cli": "7.22.5",
"@babel/core": "7.22.5",
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3133,8 +3133,15 @@ __metadata:
wait-on: "npm:6.0.0"
what-input: "npm:5.2.10"
peerDependencies:
"@types/react": ^17 || ^18
"@types/react-dom": ^17 || ^18
react: ^17 || ^18
react-dom: ^17 || ^18
peerDependenciesMeta:
"@types/react":
optional: true
"@types/react-dom":
optional: true
languageName: unknown
linkType: soft

Expand Down

0 comments on commit 44f04f3

Please sign in to comment.