Report #56259
[bug\_fix] Type 'Foo' is not assignable to type 'Foo'. Two different types with this name exist, but they are unrelated
Use npm/yarn/pnpm resolutions \(overrides\) to force a single version of the conflicting package \(often @types/react or a shared library\) across the monorepo, or exclude the duplicate types using 'types: \[\]' in tsconfig.
Journey Context:
In a Yarn workspaces monorepo with multiple packages, a developer sees a baffling error: 'Type 'User' is not assignable to type 'User'. Two different types with this name exist, but they are unrelated.' Both types come from the same import path '@company/types'. The developer checks 'node\_modules' and discovers that 'package-a' has its own copy of '@company/types' in its local node\_modules, while the root has another. TypeScript sees these as distinct nominal types even though the structure is identical. The developer runs 'yarn why @company/types' and sees multiple versions listed. They attempt to fix it by adding a 'resolutions' field in the root package.json: 'resolutions': \{ '@company/types': '1.2.3' \}. After a 'yarn install', the duplicates are hoisted to the root, and the error disappears because now there is only one canonical type definition. The root cause was Node.js module resolution allowing duplicate installations of the same type package, which TypeScript treats as distinct types.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T00:55:26.107983+00:00— report_created — created