From a8c99c95af5653e03afd240c6701f607aca665e0 Mon Sep 17 00:00:00 2001 From: HeySP6 Date: Wed, 13 Apr 2022 23:29:26 +0200 Subject: [PATCH] (migrate-to-next-js) added force dependencies version resolution to downgrade `@types/react` and `@types/react-dom` back to `v17.x.x` because of the breaking changes in version 18 that could not be fixed until either material-ui is upgraded to v5 or this PR (https://github.com/DefinitelyTyped/DefinitelyTyped/pull/59751) is merged Note this codemod (https://github.com/eps1lon/types-react-codemod) would not help because the errors are caused by library (see this https://github.com/facebook/react/issues/24304#issuecomment-1092472826 for the details) References: 1. https://stackoverflow.com/questions/71810438/compilation-issue-with-react-typescript-and-material-ui-4 2. https://github.com/DefinitelyTyped/DefinitelyTyped/pull/56210#issuecomment-1093454169 3. https://github.com/facebook/react/issues/24304#issuecomment-1092563688 4. https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/ 5. https://github.com/facebook/react/issues/24304#issuecomment-1094565891 --- package.json | 8 ++++++-- yarn.lock | 18 +++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 31b54a6..ab58ea1 100644 --- a/package.json +++ b/package.json @@ -55,8 +55,8 @@ "@types/cheerio": "0.22.30", "@types/jest": "26.0.20", "@types/node": "17.0.23", - "@types/react": "18.0.3", - "@types/react-dom": "18.0.0", + "@types/react": "17.0.44", + "@types/react-dom": "17.0.15", "args": "^5.0.0", "babel-jest": "27.5.1", "cross-env": "^5.2.0", @@ -72,5 +72,9 @@ "rimraf": "^2.6.3", "typescript": "4.6.3" }, + "resolutions": { + "@types/react": "17.0.44", + "@types/react-dom": "17.0.15" + }, "license": "MIT" } diff --git a/yarn.lock b/yarn.lock index ba3410c..1cfc19f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2975,12 +2975,12 @@ resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.7.tgz#63bb7d067db107cc1e457c303bc25d511febf6cb" integrity sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw== -"@types/react-dom@18.0.0", "@types/react-dom@^18.0.0": - version "18.0.0" - resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.0.tgz#b13f8d098e4b0c45df4f1ed123833143b0c71141" - integrity sha512-49897Y0UiCGmxZqpC8Blrf6meL8QUla6eb+BBhn69dTXlmuOlzkfr7HHY/O8J25e1lTUMs+YYxSlVDAaGHCOLg== +"@types/react-dom@17.0.15", "@types/react-dom@^18.0.0": + version "17.0.15" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.15.tgz#f2c8efde11521a4b7991e076cb9c70ba3bb0d156" + integrity sha512-Tr9VU9DvNoHDWlmecmcsE5ZZiUkYx+nKBzum4Oxe1K0yJVyBlfbq7H3eXjxXqJczBKqPGq3EgfTru4MgKb9+Yw== dependencies: - "@types/react" "*" + "@types/react" "^17" "@types/react-syntax-highlighter@11.0.5": version "11.0.5" @@ -2996,10 +2996,10 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@18.0.3": - version "18.0.3" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.3.tgz#baefa397561372015b9f8ba5bc83bc3f84ae8fcb" - integrity sha512-P8QUaMW4k+kH9aKNPl9b3XWcKMSSALYprLL8xpAMJOLUn3Pl6B+6nKC4F7dsk9oJPwkiRx+qlwhG/Zc1LxFVuQ== +"@types/react@*", "@types/react@17.0.44", "@types/react@^17": + version "17.0.44" + resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.44.tgz#c3714bd34dd551ab20b8015d9d0dbec812a51ec7" + integrity sha512-Ye0nlw09GeMp2Suh8qoOv0odfgCoowfM/9MG6WeRD60Gq9wS90bdkdRtYbRkNhXOpG4H+YXGvj4wOWhAC0LJ1g== dependencies: "@types/prop-types" "*" "@types/scheduler" "*"