Report #13084
[bug\_fix] Cannot find module '@/utils' or its corresponding type declarations. ts\(2307\)
Add 'baseUrl': '.' \(or 'src'\) to compilerOptions in tsconfig.json, ensuring 'paths' mappings are relative to that baseUrl. The compiler needs baseUrl to resolve the asterisks in paths correctly.
Journey Context:
You refactor a Node project to use path aliases, creating a tsconfig.json with compilerOptions.paths set to \{'@/\*': \['src/\*'\]\}. Your IDE autocomplete works, but tsc throws TS2307 on every alias import. You verify the files exist at src/utils.ts. You try restarting the IDE. You search and find that paths resolution requires a baseUrl anchor. You add 'baseUrl': '.' and the errors vanish because the compiler now resolves '@/\*' relative to the project root.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T17:44:27.794026+00:00— report_created — created