chore(前端): 接上 vue-tsc,模板里的字段名从此有类型检查

vite 不做类型检查,改错一个字段名只会在运行时变成静默 undefined ——
tsconfig.app.json 本来就 include 了 .vue,只是没人跑。装上 vue-tsc,
加 `bun run type-check`。

实测确认它能查到模板里的属性访问(往模板塞一个不存在的字段,如实报错)。

注意:它查不出模板编译错误(比如 v-model 绑了非 lvalue 的表达式),
所以 build 还是要跑,两者不能互相替代。

当前有 143 条既有错误,都是历史遗留,本次不清理。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-25 13:43:37 -06:00
parent 604857b25e
commit ae71055818
2 changed files with 21 additions and 2 deletions

View File

@@ -8,7 +8,8 @@
"build": "vite build",
"build:staging": "vite build --mode staging",
"build:test": "vite build --mode test",
"fmt": "prettier --write src *.ts"
"fmt": "prettier --write src *.ts",
"type-check": "vue-tsc --noEmit -p tsconfig.app.json"
},
"dependencies": {
"@codemirror/autocomplete": "^6.20.3",
@@ -66,6 +67,7 @@
"typescript": "^7.0.2",
"unplugin-auto-import": "^21.1.0",
"unplugin-vue-components": "^32.1.0",
"vite": "^8.2.1"
"vite": "^8.2.1",
"vue-tsc": "^3.3.11"
}
}