解决方式:
项目作为根目录不会有该问题。
或者改为使用 volar 插件
解决方式:
例如:
安装 jsencrypt
,引入之后报错:
Could not find a declaration file for module ‘jsencrypt‘. ‘/Users/sia/djwork/dd-inpass-psw/node_modules/jsencrypt/bin/jsencrypt.js‘ implicitly has an ‘any‘ type.
Try npm install @types/jsencrypt
if it exists or add a new declaration (.d.ts) file containing declare module ‘jsencrypt‘;
vant3如果使用ts-import-plugin,会出现无法覆盖less变量的情况,建议还是使用 babel-import-plugin。
process.env.xx
报错安装依赖
npm i @types/webpack-env @types/node -D
使用 PropType
import { PropType } from ‘vue‘
type FormItemConfig = {
...
}
someProp: {
type: Object as PropType<FormItemConfig>
}
指定 props 的类型
setup (props: FormProp, context){}
首先设置 exclude :
"exclude": [
"node_modules/**",
]
如果无效,再设置 compilerOptions :
"compilerOptions" : {
....,
"skipLibCheck": true,
}
原文:https://www.cnblogs.com/linxue/p/15232288.html