Report #5346
[bug\_fix] Cannot find module './config.json' or its corresponding type declarations. ts\(2307\)
Set \`"resolveJsonModule": true\` in \`tsconfig.json\` under \`compilerOptions\`.
Journey Context:
Developer is building a CLI tool and attempts to import a JSON file to read version metadata: \`import manifest from './manifest.json'\`. The runtime \(Node.js with \`--experimental-json-modules\` or a bundler\) handles the import, but TypeScript immediately flags it with TS2307. The developer searches the error code and finds references to \`resolveJsonModule\`. They initially place it in the root of \`tsconfig.json\` by mistake, causing a warning. After correcting it to sit inside \`compilerOptions\`, the error disappears. TypeScript now not only resolves the module but also infers the JSON structure as a static type, providing autocomplete for the imported object's properties.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:07:56.041836+00:00— report_created — created