[英]vue-cli3 eslint vue/script-indent conflicting with compiler
[英]TypeScript error importing vue package (vue-cli3 proj)
我有一个带有最新依赖项的项目,设置了 CLI 3。在我的项目中导入font- picker -vue包时出现错误(尽管包安装成功)。
错误: Could not find a declaration file for module 'font-picker-vue'......../node_modules/font-picker-vue/lib/FontPicker.js' implicitly has an 'any' type. Try npm install @types/font-picker-vue if it exists or add a new declaration (.d.ts) file containing declare module font-picker-vue';
Could not find a declaration file for module 'font-picker-vue'......../node_modules/font-picker-vue/lib/FontPicker.js' implicitly has an 'any' type. Try npm install @types/font-picker-vue if it exists or add a new declaration (.d.ts) file containing declare module font-picker-vue';
进行了谷歌搜索,建议的解决方案之一是在*.d.ts
文件中添加以下代码: src
declare module 'vuetify/lib' {
import 'vuetify/types/lib'
}
在项目的根目录中创建了一个*.d.ts
文件,如下图所示,希望它可以工作,但它没有:
接下来,按照建议, SO 回复将导入语句更改为 require: const yourModuleName = require('module-name');
并尝试从npm install -D @types/font-picker-vue
。 两者都不起作用,@types/font-picker-vue 不在 npm 注册表中。
我不确定如何解决此错误。 有人可以帮助得到这个工作。 任何帮助表示赞赏。 谢谢
创建一个带有像这样的模块声明的 yourModuleName.d.ts 文件declare module 'vuetify/lib'
然后尝试添加以下内容:
"include": "*.d.ts"
到您的 tsconfig.json 文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.