Report #100563
[bug\_fix] TS2307: Cannot find module 'lodash-es' or its corresponding type declarations.
Install the community types with \`npm i -D @types/lodash-es\`, or switch to the default \`lodash\` package which has first-party types. If the package ships its own types, set \`moduleResolution\` to \`bundler\` or \`node\` \(not \`classic\`\) and ensure \`esModuleInterop\`/\`allowSyntheticDefaultImports\` match the import style.
Journey Context:
You import \`import \{ debounce \} from 'lodash-es'\` and TypeScript reports TS2307. You check \`node\_modules/lodash-es\` and it exists, so you assume the install is broken and reinstall. The error persists. You search and find that \`lodash-es\` does not bundle TypeScript declarations; you need \`@types/lodash-es\`. After installing, another error appears: \`Cannot find module\` only in a test runner using \`ts-node\`. That turns out to be \`moduleResolution: "classic"\` inherited from an old config. Switching to \`"moduleResolution": "bundler"\` \(or \`"node"\`\) makes resolution follow \`exports\` and \`types\` fields. The fix works because TypeScript resolves declaration files through the same \`moduleResolution\` algorithm it uses for JS modules.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-02T04:43:13.963352+00:00— report_created — created