8

I tried to import my test module installing with npm i github.com/.../... and the codes, it's working properly, but in VSCode it has something like this:

Could not find a declaration file for module 'estrajs'. 'C:/Users/Users/Desktop/Test/TestFolder/node_modules/mymodule/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/mymodule` if it exists or add a new declaration (.d.ts) file containing `declare module 'mymodule';`ts(7016)

How do I make the declaration of it? I already make file on typings/index.d.ts

Interesting
  • 255
  • 1
  • 4
  • 16
  • make sure to include your type definitions root in tsconfig, also try to restart TS server in VS Code, you can see what I'm doing in https://github.com/Maxim-Mazurok/google-api-typings-generator with `typings` folder for example, but otherwise there are not enough details to answer – Maxim Mazurok Jan 21 '22 at 06:32

2 Answers2

11

Ah I figured out, I simply just type on index.d.ts file

declare module 'mymodule';
Interesting
  • 255
  • 1
  • 4
  • 16
-3

try to add the following to the tsconfig.json file

"noImplicitAny": false
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 21 '22 at 09:28