找不到第三方模块的声明文件 - 如何声明和解决这些错误 [英] Could not find a declaration file for third party modules - how to declare and resolve these errors
本文介绍了找不到第三方模块的声明文件 - 如何声明和解决这些错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 typescript(使用 vue cli 3.0 生成)进行一个项目.
I am working on a project with typescript (generated with vue cli 3.0).
当我导入第三方模块时,出现如下错误:
When I import third party modules, I get errors such as:
Could not find a declaration file for module 'vue-slider-component'.
'/home/wahid/Development/tealvalley-app/node_modules/vue-slider-
component/dist/index.js' implicitly has an 'any' type.
解决此类问题的正确方法是什么?@types 包中没有定义类型,所以如果我自己定义它们,我应该把它放在哪里?
What is the correct way to resolve these kind of issues? The types are not defined in the @types package, so if I were to define them myself, where do I keep it?
推荐答案
解决此类问题的正确方法是什么?
What is the correct way to resolve these kind of issues?
创建文件 vendor.d.ts
具有:
Create a file vendor.d.ts
that has:
declare module 'vue-slider-component';
这篇关于找不到第三方模块的声明文件 - 如何声明和解决这些错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文