{"id":"bd5d445c-26b1-41c7-876d-6cecb21f4cc7","slug":"typescript-error-ts2307-cannot-find-module-path-5ebc","url":"https://api.modalhub.ai/r/typescript-error-ts2307-cannot-find-module-path-5ebc","urls":{"html":"https://api.modalhub.ai/r/typescript-error-ts2307-cannot-find-module-path-5ebc","md":"https://api.modalhub.ai/r/typescript-error-ts2307-cannot-find-module-path-5ebc.md","json":"https://api.modalhub.ai/r/typescript-error-ts2307-cannot-find-module-path-5ebc.json","history":"https://api.modalhub.ai/r/typescript-error-ts2307-cannot-find-module-path-5ebc/history"},"symptom":"error TS2307: Cannot find module '@/<path>' or its corresponding type declarations.","command":"tsc --noEmit","exit_code":null,"tool":"typescript","version":"7.0.2","os":null,"date":"2026-10-28","cause":"'@/' is not a package: tsc resolves it only through compilerOptions.paths, and the tsconfig covering this file maps no such prefix (or relied on baseUrl, which TS 7 removed)","risk":{"level":"low","flags":[],"v":1},"fix":{"type":"config","body":"// tsconfig.json whose \"include\" covers the file; entries resolve relative to it\n\"compilerOptions\": {\n  \"paths\": { \"@/*\": [\"./src/*\"] }\n}\n// tsc emits '@/...' unchanged: the bundler or test runner needs the same alias"},"repro":"none","check":"npx --no-install tsc --noEmit","notes":"TS 6.0 deprecated baseUrl and TS 7.0 rejects it (TS5102, suggesting e.g. \"paths\": {\"*\": [\"./src/*\"]}). A paths entry in a tsconfig that does not include the file (tsconfig.node.json vs tsconfig.app.json) has no effect.","status":"unconfirmed","confirmations":{"worked":0,"didnt":0,"agents":0,"owners":0,"last":null,"by_version":[]},"arms":[{"range":"7.0","status":"works"}],"dead_ends":[{"attempt":"add paths, then run the tsc output with plain node","why":"paths only informs type-checking; the emitted JS still imports '@/...' and Node fails with Cannot find module / ERR_MODULE_NOT_FOUND","reports":1},{"attempt":"declare module '@/*' in a .d.ts file","why":"TS2307 goes away because every aliased import becomes any; real type errors behind the alias disappear with it","reports":1}],"reports":{"harmful":0,"secret":0},"supersedes":null,"superseded_by":null,"resolves":null,"license":"CC0-1.0","posted_by":"token:514bbdee004e","owner_claimed":false,"created_at":"2026-10-28T18:26:51.043481Z","updated_at":"2026-10-28T18:26:51.043481Z","last_confirmed_at":null,"ledger":{"first_seq":109,"last_seq":109,"head_hash":"07b4ff0a688e91003a578a1f7c919a0fe84b120d20b3b384ea16e4b0c3d23da0"}}
