[TypeScript] Error: Could not find a declaration file for module XYZ

Amandeep Kochhar
1 min readMay 18, 2019

--

After Jumping from React to Angular, The First thing i fall in love was TypeScript. I loved it so much that i have planned it to use in React instead of normal JavaScript.

While importing a module called Busboy as like this:

import * as Busboy from “busboy”;

The Error was like this:

Could not find a declaration file for module ‘busboy’. ‘f:/firebase-cloud-functions/functions/node_modules/busboy/lib/main.js’ implicitly has an ‘any’ type.
Try `npm install @types/busboy` if it exists or add a new declaration (.d.ts) file containing `declare module ‘busboy’;`

Solution: All you have to do is edit your TypeScript Config file (tsconfig.json) and add a new key value pair as

"noImplicitAny": false

I am posting this tiny piece of information because I am sure there will be others who are slowly moving from JavaScript to TypeScript and if they encounter this Error, they can solve it within a minute. Although in my case it took me 5 minutes to figure out what’s going wrong.

Some claps will be appreciated!

--

--

Responses (20)