Skip to content
Latchkey

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

  1. Install @types/<pkg> if one is published
shell
npm i -D @types/some-js-lib

Provide a local declaration

  1. 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

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card