Skip to content

Commit d8a2391

Browse files
committed
feat: Move @types/react-dom to peer dependencies
Type dependencies need to match their runtime counterpart. If `foo` is a dependency, `@types/foo` needs to be one as well. If `foo` is a peer dependency, `@types/foo` needs to be one as well. This is especially apparent if the constraint on `foo` spans multiple major versions. If we'd make `@types/foo` a direct dependency, users couldn't control which major version they get. Package managers would pick the highest. By moving `@types/foo` to peer dependencies, users can control which version of `foo` and `@types/foo` they have.
1 parent d143f46 commit d8a2391

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

package.json

+8-2
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@
4646
"license": "MIT",
4747
"dependencies": {
4848
"@babel/runtime": "^7.12.5",
49-
"@testing-library/dom": "^10.0.0",
50-
"@types/react-dom": "^18.0.0"
49+
"@testing-library/dom": "^10.0.0"
5150
},
5251
"devDependencies": {
52+
"@types/react-dom": "^18.2.25",
5353
"@testing-library/jest-dom": "^5.11.6",
5454
"chalk": "^4.1.2",
5555
"dotenv-cli": "^4.0.0",
@@ -62,9 +62,15 @@
6262
"typescript": "^4.1.2"
6363
},
6464
"peerDependencies": {
65+
"@types/react-dom": "^18.0.0",
6566
"react": "^18.0.0",
6667
"react-dom": "^18.0.0"
6768
},
69+
"peerDependenciesMeta": {
70+
"@types/react-dom": {
71+
"optional": true
72+
}
73+
},
6874
"eslintConfig": {
6975
"extends": "./node_modules/kcd-scripts/eslint.js",
7076
"parserOptions": {

0 commit comments

Comments
 (0)