安装
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 less变量无法覆盖
vant3如果使用ts-import-plugin,会出现无法覆盖less变量的情况,建议还是使用 babel-import-plugin。
webpack require.context 无法使用 , 使用
process.env.xx
报错
npm i @types/webpack-env @types/node -D
如何定义 vue 组件 props 的类型
使用 PropType
import { PropType } from 'vue'
type FormItemConfig = {
someProp: {
type: Object as PropType<FormItemConfig>
setup 获取 props 的值失败
指定 props 的类型
setup (props: FormProp, context){}
忽略 node_modules 里面的检查
首先设置 exclude :
"exclude": [
"node_modules/**",
如果无效,再设置 compilerOptions :
"compilerOptions" : {
....,
"skipLibCheck": true,