TS7016: Could not find a declaration file for module - in CI
The module resolves at runtime but ships no types and has no @types package, so under noImplicitAny tsc errors.
What this error means
Type-checking fails with TS7016 suggesting you try npm i --save-dev @types/<pkg> or add your own declaration.
tsc
src/legacy.ts(1,20): error TS7016: Could not find a declaration file for module 'some-js-lib'. '/app/node_modules/some-js-lib/index.js' implicitly has an 'any' type.Common causes
How to fix it
Install the types package
- Install @types/<pkg> if one is published
shell
npm i -D @types/some-js-libProvide a local declaration
- Add a .d.ts that declares the module when no @types exist
types/some-js-lib.d.ts
declare module 'some-js-lib'How to prevent it
- Install @types for untyped dependencies or ship a minimal local declaration so CI stays type-clean.
Frequently asked questions
What causes "TS7016 no declaration file"?
Type-checking fails with TS7016 suggesting you try npm i --save-dev @types/<pkg> or add your own declaration.
How do I fix TS7016 no declaration file?
Install the types package
Related guides
TS2307: Cannot find module - in CIFix "error TS2307: Cannot find module 'x' or its corresponding type declarations" when tsc runs in CI - a mis…
TS2688: Cannot find type definition file for - in CIFix "error TS2688: Cannot find type definition file for 'x'" when tsc runs in CI - a types entry that is not…
TS7006: Parameter implicitly has an any type - in CIFix "error TS7006: Parameter 'x' implicitly has an 'any' type" under noImplicitAny when tsc runs in CI.