简体   繁体   English

找不到模块“mymodule”的声明文件

[英]Could not find a declaration file for module 'mymodule'

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:我尝试导入我的测试模块安装npm i github.com/.../...和代码,它工作正常,但在 VSCode 中它有这样的东西:

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我已经在 typings/index.d.ts 上制作了文件

Ah I figured out, I simply just type on index.d.ts file啊,我想通了,我只是输入 index.d.ts 文件

declare module 'mymodule';

try to add the following to the tsconfig.json file尝试将以下内容添加到 tsconfig.json 文件中

"noImplicitAny": false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM