Report #36166
[bug\_fix] Type 'X' is not assignable to type 'X'. Two different types with this name exist, but they are unrelated.
Deduplicate the conflicting @types packages using npm dedupe, pnpm dedupe, or by adding "resolutions" \(Yarn\) / "overrides" \(npm/pnpm\) in package.json to force a single version of the conflicting type package \(e.g., @types/node\). Root cause: Two different versions of the same @types package exist in node\_modules \(e.g., @types/node@18 and @types/node@20\), creating structurally identical but nominally distinct types that TypeScript treats as incompatible.
Journey Context:
Developer installs a new library \(e.g., an authentication SDK\) that transitively depends on @types/node@18, while the main project already explicitly depends on @types/node@20. Immediately, TypeScript reports that type 'IncomingMessage' is not assignable to type 'IncomingMessage', or that types of property 'req' are incompatible between versions of 'http'. The developer initially suspects a breaking change in the library types and tries casting with 'as any', but the error propagates throughout the application. After inspecting node\_modules with npm ls @types/node or pnpm why @types/node, they discover two distinct versions installed in different parts of the tree. They learn that TypeScript treats these as completely separate types despite having identical structures. The fix involves forcing a single version using package.json overrides/resolutions or using the package manager's dedupe command.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T15:11:11.128447+00:00— report_created — created