瀏覽代碼

chore: typescript 调整

lanceJiang 8 月之前
父節點
當前提交
3479496739
共有 2 個文件被更改,包括 60 次插入54 次删除
  1. 5 5
      src/types/components.d.ts
  2. 55 49
      src/types/global.d.ts

+ 5 - 5
src/components.d.ts → src/types/components.d.ts

@@ -1,15 +1,15 @@
 // 全局组件类型声明
 import TableComponent from '@/components/Table/index.vue'
 import FormConfig from '@/components/FormConfig/index.vue'
-import DialogForm from '@/components/DialogForm.vue'
+import FormConfigDialog from '@/components/FormConfigDialog.vue'
 import SearchForm from '@/components/SearchForm.vue'
 
 declare module '@vue/runtime-core' {
 	export interface GlobalComponents {
-		TableComponent: typeof TableComponent
-		FormConfig: typeof FormConfig
-		DialogForm: typeof DialogForm
-		SearchForm: typeof SearchForm
+		LeTable: typeof TableComponent
+		LeFormConfig: typeof FormConfig
+		LeFormConfigDialog: typeof FormConfigDialog
+		LeSearchForm: typeof SearchForm
 	}
 }
 export {}

+ 55 - 49
src/types/global.d.ts

@@ -1,15 +1,6 @@
+import type { VNodeChild, PropType as VuePropType } from 'vue'
 import { AppRouteRecordRaw, MetaProps } from '@/router/types'
 
-/* RouteMenu */
-declare namespace RouteMenu {
-	interface Item extends AppRouteRecordRaw {
-		component?: string | (() => Promise<unknown>)
-	}
-	interface Meta extends MetaProps {
-		test?: any
-	}
-}
-
 /* FileType */
 declare namespace File {
 	type ImageMimeType =
@@ -27,46 +18,66 @@ declare namespace File {
 	type ExcelMimeType = 'application/vnd.ms-excel' | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
 }
 
-/* Vite */
-declare type Recordable<T = any> = Record<string, T>
+declare global {
+	/* __APP_INFO__ */
+	declare const __APP_INFO__: {
+		pkg: {
+			name: string
+			version: string
+			dependencies: Recordable<string>
+			devDependencies: Recordable<string>
+		}
+		lastBuildTime: string
+	}
+	interface Window {
+		// requestIdleCallback?: Function;
+		[key: string]: any
+	}
 
-declare interface ViteEnv {
-	VITE_USER_NODE_ENV: 'development' | 'production' | 'test'
-	VITE_APP_TITLE: string
-	VITE_PORT: number
-	VITE_OPEN: boolean
-	VITE_REPORT: boolean
-	VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'gzip,brotli' | 'none'
-	VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean
-	VITE_DROP_CONSOLE: boolean
-	VITE_PUBLIC_PATH: string
-	VITE_API_URL: string
-	VITE_PROXY: [string, string][]
-}
+	declare type Recordable<T = any> = Record<string, T>
+	declare type DeepPartial<T> = {
+		[P in keyof T]?: DeepPartial<T[P]>
+	}
+	/* Generic Tools */
+	type ObjToKeyValUnion<T> = {
+		[K in keyof T]: { key: K; value: T[K] }
+	}[keyof T]
 
-interface ImportMetaEnv extends ViteEnv {
-	__: unknown
-}
+	type ObjToKeyValArray<T> = {
+		[K in keyof T]: [K, T[K]]
+	}[keyof T]
+	/* Vite */
+	declare interface ViteEnv {
+		VITE_USER_NODE_ENV: 'development' | 'production' | 'test'
+		VITE_APP_TITLE: string
+		VITE_PORT: number
+		VITE_OPEN: boolean
+		VITE_REPORT: boolean
+		VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'gzip,brotli' | 'none'
+		VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean
+		VITE_DROP_CONSOLE: boolean
+		VITE_PUBLIC_PATH: string
+		VITE_API_URL: string
+		VITE_PROXY: [string, string][]
+	}
 
-/* __APP_INFO__ */
-declare const __APP_INFO__: {
-	pkg: {
-		name: string
-		version: string
-		dependencies: Recordable<string>
-		devDependencies: Recordable<string>
+	interface ImportMetaEnv extends ViteEnv {
+		__: unknown
 	}
-	lastBuildTime: string
-}
 
-/* Generic Tools */
-type ObjToKeyValUnion<T> = {
-	[K in keyof T]: { key: K; value: T[K] }
-}[keyof T]
+	/* RouteMenu */
+	declare namespace RouteMenu {
+		interface Item extends AppRouteRecordRaw {
+			component?: string | (() => Promise<unknown>)
+		}
+		interface Meta extends MetaProps {
+			test?: any
+		}
+	}
 
-type ObjToKeyValArray<T> = {
-	[K in keyof T]: [K, T[K]]
-}[keyof T]
+	declare type PropType<T> = VuePropType<T>
+	declare type VueNode = VNodeChild | JSX.Element
+}
 
 // declare module 'vue' {
 // 	export type JSXComponent<Props = any> =
@@ -84,8 +95,3 @@ declare module 'virtual:*' {
 	const result: any
 	export default result
 }
-
-interface Window {
-	// requestIdleCallback?: Function;
-	[key: string]: any
-}