【发布时间】:2022-01-21 19:04:34
【问题描述】:
我尝试导入使用 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)
如何声明它?我已经在 typings/index.d.ts 上制作了文件
【问题讨论】:
-
确保在 tsconfig 中包含您的类型定义根目录,还尝试在 VS Code 中重新启动 TS 服务器,您可以看到我在 github.com/Maxim-Mazurok/google-api-typings-generator 中使用
typings文件夹进行的操作,但是否则没有足够的细节来回答
标签: javascript node.js angular typescript