Report #14962
[bug\_fix] TS2345: Argument of type 'ReactNode' is not assignable to parameter of type 'ReactNode'. Two different types with this name exist, but they are unrelated
Force a single version of the conflicting @types package using 'resolutions' \(Yarn\) or 'overrides' \(npm\) in package.json to deduplicate the type definitions, then delete node\_modules and lockfile and reinstall.
Journey Context:
Developer is working in a monorepo or a project with complex transitive dependencies. They install a new library that depends on @types/react@17 while their project uses @types/react@18. When they try to pass a ReactNode from their component to a function from the new library, TypeScript reports TS2345, showing two different import paths for ReactNode in the error message: one from 'node\_modules/@types/react/index' and another from 'node\_modules/new-lib/node\_modules/@types/react/index'. The developer tries to cast the value with 'as any' which works but loses type safety. They try to use TypeScript's 'paths' mapping to force resolution to a single location, but this is fragile. They run 'npm ls @types/react' and see multiple versions installed. Realizing that TypeScript treats types from different physical locations as distinct nominal types even if structurally identical, they understand they must deduplicate the package. They add '"overrides": \{ "@types/react": "^18.0.0" \}' to package.json \(or '"resolutions"' for Yarn\), delete node\_modules and package-lock.json, and reinstall, ensuring only one copy of @types/react exists in the tree.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T22:50:22.040288+00:00— report_created — created