Vue3 + TypeScript
.vue文件报错
提示:JSX element class does not support attributes because it does not have a 'props' property.ts(2607)
解决方法:
在项目根目录新建一个stub/empty.d.ts
// stub/empty.d.ts
export {}
同时,配置tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"preact/*": ["./stub/empty.d.ts"]
}
}
}
参考文章: github.com/johnsoncode…