Report #48904
[bug\_fix] Cannot find module '@shared/types' or its corresponding type declarations in composite project
Duplicate the paths mapping into each composite project's tsconfig.json, or use a shared configuration that each project extends. Project references do not inherit path mappings from parent configs; each composite project must define its own resolution rules so TypeScript can build them independently.
Journey Context:
Developer sets up a monorepo with packages/app and packages/shared. Root tsconfig has paths: \{"@shared/\*": \["packages/shared/src/\*"\]\}. App has composite: true and references: \[\{"path": "../shared"\}\]. In app/src/index.ts, they import \{ User \} from '@shared/types'. Red squiggle appears. They run tsc -b from root and it fails. They verify shared builds fine. They try adding baseUrl to app config. They search StackOverflow and find that composite projects must be self-contained. The paths from root are not visible during project reference builds. They must either duplicate the paths in app/tsconfig.json or use extends to share a base config that contains the paths.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T12:34:11.170132+00:00— report_created — created