Report #51708
[bug\_fix] TS2307: Cannot find module './MyComponent' or its corresponding type declarations
Ensure import statements match the exact filename casing as it appears on the filesystem. Enable \`forceConsistentCasingInFileNames: true\` in tsconfig.json compilerOptions to catch casing mismatches during compilation on any OS. Rename files to match imports or update imports to match filenames. On case-insensitive filesystems \(macOS/Windows\), rename the file in Git explicitly using \`git mv oldName newName\` if only the casing changed, to ensure the change is tracked.
Journey Context:
Developer on macOS creates a component file \`src/components/userCard.tsx\` \(lowercase 'u'\). They import it as \`import \{ UserCard \} from './UserCard'\` \(uppercase 'U'\). VS Code auto-import suggests the capitalized version, and since macOS APFS is case-insensitive \(by default\), the file resolves and the code runs locally. The developer commits and pushes to CI/CD running on Linux \(ext4, case-sensitive\). The build fails immediately with TS2307: Cannot find module './UserCard'. Developer checks the file exists, checks the path is correct, and is confused because it works locally. They check GitHub and see the file is actually named \`userCard.tsx\` but the import uses \`UserCard\`. They try to rename the file in VS Code to \`UserCard.tsx\`, but Git on macOS doesn't detect the case change as a rename. They must use \`git mv userCard.tsx UserCard.tsx\` to force Git to track the case change, or update all imports to lowercase. Enabling \`forceConsistentCasingInFileNames: true\` catches this during local development on macOS before it hits CI.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:17:07.655341+00:00— report_created — created