perf: 优化全局 ts 配置
This commit is contained in:
parent
ea253ab1a9
commit
d29e5ba062
@ -1,5 +1,7 @@
|
||||
// https://www.typescriptlang.org/tsconfig
|
||||
// https://cn.vuejs.org/guide/typescript/overview#configuring-tsconfig-json
|
||||
// https://cn.vite.dev/guide/features#typescript-compiler-options
|
||||
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
@ -27,6 +29,13 @@
|
||||
"isolatedModules": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
// 编译器默认排除的编译文件
|
||||
// 需要被编译的文件列表
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
"**/*.vue",
|
||||
"**/*.d.ts"
|
||||
],
|
||||
// 从编译中排除的文件列表
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
|
2
types/env.d.ts
vendored
2
types/env.d.ts
vendored
@ -1,7 +1,7 @@
|
||||
/** 声明 vite 环境变量的类型(如果未声明则默认是 any) */
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_APP_TITLE: string
|
||||
readonly VITE_BASE_API: string
|
||||
readonly VITE_BASE_URL: string
|
||||
readonly VITE_ROUTER_HISTORY: "hash" | "html5"
|
||||
readonly VITE_PUBLIC_PATH: string
|
||||
}
|
||||
|
6
types/global-components.d.ts
vendored
6
types/global-components.d.ts
vendored
@ -1,10 +1,10 @@
|
||||
import type SvgIcon from "@/components/SvgIcon/index.vue"
|
||||
|
||||
/** 由 app.component 全局注册的组件需要在这里声明 TS 类型才能获得 Volar 插件提供的类型提示) */
|
||||
export {}
|
||||
|
||||
// 由 app.component 全局注册的组件需要在这里声明 TS 类型才能获得 Volar 插件提供的类型提示)
|
||||
declare module "vue" {
|
||||
export interface GlobalComponents {
|
||||
SvgIcon: typeof SvgIcon
|
||||
}
|
||||
}
|
||||
|
||||
export {}
|
||||
|
11
types/global-directives.d.ts
vendored
Normal file
11
types/global-directives.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
import type { Directive } from "vue"
|
||||
|
||||
export {}
|
||||
|
||||
// 由 app.directive 全局注册的自定义指令需要在这里声明 TS 类型才能获得类型提示
|
||||
declare module "vue" {
|
||||
export interface ComponentCustomProperties {
|
||||
vLoading: Directive<Element, boolean>
|
||||
vPermission: Directive<Element, string[]>
|
||||
}
|
||||
}
|
4
types/shims-vue.d.ts
vendored
4
types/shims-vue.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
declare module "*.scss" {
|
||||
const scss: Record<string, string>
|
||||
export default scss
|
||||
}
|
2
types/vue-router.d.ts
vendored
2
types/vue-router.d.ts
vendored
@ -1,5 +1,7 @@
|
||||
import "vue-router"
|
||||
|
||||
export {}
|
||||
|
||||
declare module "vue-router" {
|
||||
interface RouteMeta {
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user