From 60b484a2ad1ee975397dc0f20123ab4dfadbd3b4 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Wed, 9 Apr 2025 07:45:37 +0530 Subject: [PATCH] Fix type errors by ensuring single react types --- web/apps/photos/src/components/Collections/AllAlbums.tsx | 2 -- web/apps/photos/src/components/FileList.tsx | 2 -- web/docs/dependencies.md | 3 +++ web/package.json | 4 ++++ web/yarn.lock | 9 +-------- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/web/apps/photos/src/components/Collections/AllAlbums.tsx b/web/apps/photos/src/components/Collections/AllAlbums.tsx index 4fb5dd2c65..c9bcf6993f 100644 --- a/web/apps/photos/src/components/Collections/AllAlbums.tsx +++ b/web/apps/photos/src/components/Collections/AllAlbums.tsx @@ -267,8 +267,6 @@ const AllAlbumsContent: React.FC = ({ itemSize={CollectionRowItemSize} itemData={itemData} > - {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */ - /* @ts-ignore TODO deal with this new react-window type error */} {AlbumsRow} )} diff --git a/web/apps/photos/src/components/FileList.tsx b/web/apps/photos/src/components/FileList.tsx index 834bc6ae0c..c238edcb80 100644 --- a/web/apps/photos/src/components/FileList.tsx +++ b/web/apps/photos/src/components/FileList.tsx @@ -908,8 +908,6 @@ export const FileList: React.FC = ({ overscanCount={3} useIsScrolling > - {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */ - /* @ts-ignore TODO deal with this new react-window type error */} {PhotoListRow} ); diff --git a/web/docs/dependencies.md b/web/docs/dependencies.md index dfef884420..2e45cd9b90 100644 --- a/web/docs/dependencies.md +++ b/web/docs/dependencies.md @@ -93,6 +93,9 @@ DOM. > package.jsons to avoid the unmet peer dependency warnings printed by yarn. > Ideally, the react dependencies can be specified just in the _ente-base_ > package. For now, we manually ensure that all of them use the same version. +> Additionally, we pin the versions of the react types using the resolutions +> field in the top level `package.json`, otherwise we end up with type errors +> because of multiple versions of react types being in scope. ### MUI and Material Icons diff --git a/web/package.json b/web/package.json index 72cdb14780..a6a30a843a 100644 --- a/web/package.json +++ b/web/package.json @@ -23,6 +23,10 @@ "lint": "concurrently --names 'prettier,eslint,tsc' \"yarn prettier --check --log-level warn .\" \"yarn workspaces run eslint\" \"yarn workspaces run tsc\"", "lint-fix": "concurrently --names 'prettier,eslint,tsc' \"yarn prettier --write --log-level warn .\" \"yarn workspaces run eslint --fix\" \"yarn workspaces run tsc\"" }, + "resolutions": { + "@types/react": "^19.1.0", + "@types/react-dom": "^19.1.1" + }, "devDependencies": { "concurrently": "^9.1.2", "eslint": "^9.21.0", diff --git a/web/yarn.lock b/web/yarn.lock index 48f9fae5ac..b817f2d693 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -1131,14 +1131,7 @@ dependencies: "@types/react" "*" -"@types/react@*": - version "19.0.2" - resolved "https://registry.yarnpkg.com/@types/react/-/react-19.0.2.tgz#9363e6b3ef898c471cb182dd269decc4afc1b4f6" - integrity sha512-USU8ZI/xyKJwFTpjSVIrSeHBVAGagkHQKPNbxeWwql/vDmnTIBgx+TJnhFnj1NXgz8XfprU0egV2dROLGpsBEg== - dependencies: - csstype "^3.0.2" - -"@types/react@^19.1.0": +"@types/react@*", "@types/react@^19.1.0": version "19.1.0" resolved "https://registry.yarnpkg.com/@types/react/-/react-19.1.0.tgz#73c43ad9bc43496ca8184332b111e2aef63fc9da" integrity sha512-UaicktuQI+9UKyA4njtDOGBD/67t8YEBt2xdfqu8+gP9hqPUPsiXlNPcpS2gVdjmis5GKPG3fCxbQLVgxsQZ8w==