From 6fd5cd4d62cbf53ff82646fad78e94a122421d31 Mon Sep 17 00:00:00 2001 From: hello8693 <1320998105@qq.com> Date: Sun, 4 Aug 2024 21:01:51 +0800 Subject: [PATCH] =?UTF-8?q?refactor(typescript):=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E7=BB=84=E4=BB=B6=E5=92=8C=E8=87=AA=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E4=B8=AD=E7=9A=84=E5=A4=9A=E4=BD=99=E5=A3=B0=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除@vue/runtime-core的冗余模块声明,简化了全局组件的TypeScript定义。同时,优化了组件声明,提高了代码的可读性和维护性。 --- src/renderer/src/auto-imports.d.ts | 59 ------------------------------ src/renderer/src/components.d.ts | 2 +- 2 files changed, 1 insertion(+), 60 deletions(-) diff --git a/src/renderer/src/auto-imports.d.ts b/src/renderer/src/auto-imports.d.ts index a61d3b4..a7c7b79 100644 --- a/src/renderer/src/auto-imports.d.ts +++ b/src/renderer/src/auto-imports.d.ts @@ -139,62 +139,3 @@ declare module 'vue' { readonly watchSyncEffect: UnwrapRef<(typeof import('vue'))['watchSyncEffect']>; } } -declare module '@vue/runtime-core' { - interface GlobalComponents {} - interface ComponentCustomProperties { - readonly EffectScope: UnwrapRef<(typeof import('vue'))['EffectScope']>; - readonly computed: UnwrapRef<(typeof import('vue'))['computed']>; - readonly createApp: UnwrapRef<(typeof import('vue'))['createApp']>; - readonly customRef: UnwrapRef<(typeof import('vue'))['customRef']>; - readonly defineAsyncComponent: UnwrapRef<(typeof import('vue'))['defineAsyncComponent']>; - readonly defineComponent: UnwrapRef<(typeof import('vue'))['defineComponent']>; - readonly effectScope: UnwrapRef<(typeof import('vue'))['effectScope']>; - readonly getCurrentInstance: UnwrapRef<(typeof import('vue'))['getCurrentInstance']>; - readonly getCurrentScope: UnwrapRef<(typeof import('vue'))['getCurrentScope']>; - readonly h: UnwrapRef<(typeof import('vue'))['h']>; - readonly inject: UnwrapRef<(typeof import('vue'))['inject']>; - readonly isProxy: UnwrapRef<(typeof import('vue'))['isProxy']>; - readonly isReactive: UnwrapRef<(typeof import('vue'))['isReactive']>; - readonly isReadonly: UnwrapRef<(typeof import('vue'))['isReadonly']>; - readonly isRef: UnwrapRef<(typeof import('vue'))['isRef']>; - readonly markRaw: UnwrapRef<(typeof import('vue'))['markRaw']>; - readonly nextTick: UnwrapRef<(typeof import('vue'))['nextTick']>; - readonly onActivated: UnwrapRef<(typeof import('vue'))['onActivated']>; - readonly onBeforeMount: UnwrapRef<(typeof import('vue'))['onBeforeMount']>; - readonly onBeforeUnmount: UnwrapRef<(typeof import('vue'))['onBeforeUnmount']>; - readonly onBeforeUpdate: UnwrapRef<(typeof import('vue'))['onBeforeUpdate']>; - readonly onDeactivated: UnwrapRef<(typeof import('vue'))['onDeactivated']>; - readonly onErrorCaptured: UnwrapRef<(typeof import('vue'))['onErrorCaptured']>; - readonly onMounted: UnwrapRef<(typeof import('vue'))['onMounted']>; - readonly onRenderTracked: UnwrapRef<(typeof import('vue'))['onRenderTracked']>; - readonly onRenderTriggered: UnwrapRef<(typeof import('vue'))['onRenderTriggered']>; - readonly onScopeDispose: UnwrapRef<(typeof import('vue'))['onScopeDispose']>; - readonly onServerPrefetch: UnwrapRef<(typeof import('vue'))['onServerPrefetch']>; - readonly onUnmounted: UnwrapRef<(typeof import('vue'))['onUnmounted']>; - readonly onUpdated: UnwrapRef<(typeof import('vue'))['onUpdated']>; - readonly provide: UnwrapRef<(typeof import('vue'))['provide']>; - readonly reactive: UnwrapRef<(typeof import('vue'))['reactive']>; - readonly readonly: UnwrapRef<(typeof import('vue'))['readonly']>; - readonly ref: UnwrapRef<(typeof import('vue'))['ref']>; - readonly resolveComponent: UnwrapRef<(typeof import('vue'))['resolveComponent']>; - readonly shallowReactive: UnwrapRef<(typeof import('vue'))['shallowReactive']>; - readonly shallowReadonly: UnwrapRef<(typeof import('vue'))['shallowReadonly']>; - readonly shallowRef: UnwrapRef<(typeof import('vue'))['shallowRef']>; - readonly toRaw: UnwrapRef<(typeof import('vue'))['toRaw']>; - readonly toRef: UnwrapRef<(typeof import('vue'))['toRef']>; - readonly toRefs: UnwrapRef<(typeof import('vue'))['toRefs']>; - readonly toValue: UnwrapRef<(typeof import('vue'))['toValue']>; - readonly triggerRef: UnwrapRef<(typeof import('vue'))['triggerRef']>; - readonly unref: UnwrapRef<(typeof import('vue'))['unref']>; - readonly useAttrs: UnwrapRef<(typeof import('vue'))['useAttrs']>; - readonly useCssModule: UnwrapRef<(typeof import('vue'))['useCssModule']>; - readonly useCssVars: UnwrapRef<(typeof import('vue'))['useCssVars']>; - readonly useRoute: UnwrapRef<(typeof import('vue-router/auto'))['useRoute']>; - readonly useRouter: UnwrapRef<(typeof import('vue-router/auto'))['useRouter']>; - readonly useSlots: UnwrapRef<(typeof import('vue'))['useSlots']>; - readonly watch: UnwrapRef<(typeof import('vue'))['watch']>; - readonly watchEffect: UnwrapRef<(typeof import('vue'))['watchEffect']>; - readonly watchPostEffect: UnwrapRef<(typeof import('vue'))['watchPostEffect']>; - readonly watchSyncEffect: UnwrapRef<(typeof import('vue'))['watchSyncEffect']>; - } -} diff --git a/src/renderer/src/components.d.ts b/src/renderer/src/components.d.ts index ee40037..c92de2b 100644 --- a/src/renderer/src/components.d.ts +++ b/src/renderer/src/components.d.ts @@ -8,7 +8,7 @@ export {}; declare module 'vue' { export interface GlobalComponents { AppFooter: (typeof import('./components/AppFooter.vue'))['default'] - AppTopBar: (typeof import('./components/AppTopBar.vue'))['default'] + AppTopBar: typeof import('./components/AppTopBar.vue')['default'] Clock: typeof import('./components/Clock.vue')['default'] DBtn: typeof import('vue-devui/btn/index.es.js')['Btn'] DButton: typeof import('vue-devui/button/index.es.js')['Button']