Pārlūkot izejas kodu

build: 添加Vue SFC编译器类型引用和配置

在env.d.ts中添加@vue/compiler-sfc类型引用,并在tsconfig.app.json中配置types字段以包含vite/client和@vue/compiler-sfc类型定义,确保TypeScript能正确识别Vue单文件组件类型
liujia 2 mēneši atpakaļ
vecāks
revīzija
a1422060ac
2 mainītis faili ar 20 papildinājumiem un 6 dzēšanām
  1. 1 0
      env.d.ts
  2. 19 6
      tsconfig.app.json

+ 1 - 0
env.d.ts

@@ -1,4 +1,5 @@
 /// <reference types="vite/client" />
+/// <reference types="@vue/compiler-sfc" />
 
 interface ImportMetaEnv {
   // 基础配置

+ 19 - 6
tsconfig.app.json

@@ -1,12 +1,25 @@
 {
   "extends": "@vue/tsconfig/tsconfig.json",
-  "include": ["env.d.ts", "src/**/*", "src/**/*.vue",  "src/**/*.d.ts",],
-  "exclude": ["src/**/__tests__/*"],
+  "include": [
+    "env.d.ts",
+    "src/**/*",
+    "src/**/*.vue",
+    "src/**/*.d.ts",
+  ],
+  "exclude": [
+    "src/**/__tests__/*"
+  ],
   "compilerOptions": {
     "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
-    "moduleResolution": "node", 
+    "moduleResolution": "node",
     "paths": {
-      "@/*": ["./src/*"]
+      "@/*": [
+        "./src/*"
+      ]
     }
-  }
-}
+  },
+  "types": [
+    "vite/client",
+    "@vue/compiler-sfc"
+  ]
+}