Browse Source

chore: remove declare module '*.vue'

main
刘凯 1 year ago
parent
commit
ff9fdff18b
  1. 3
      src/router/helper/routeHelper.ts
  2. 4
      src/router/types.ts
  3. 10
      src/types/module.d.ts

3
src/router/helper/routeHelper.ts

@ -1,6 +1,7 @@
import type { RouteRecordNormalized, Router } from 'vue-router' import type { RouteRecordNormalized, Router } from 'vue-router'
import { createRouter, createWebHashHistory } from 'vue-router' import { createRouter, createWebHashHistory } from 'vue-router'
import { cloneDeep, omit } from 'lodash-es' import { cloneDeep, omit } from 'lodash-es'
import type { Component } from 'vue'
import { EXCEPTION_COMPONENT, LAYOUT, getParentLayout } from '@/router/constant' import { EXCEPTION_COMPONENT, LAYOUT, getParentLayout } from '@/router/constant'
import type { AppRouteModule, AppRouteRecordRaw } from '@/router/types' import type { AppRouteModule, AppRouteRecordRaw } from '@/router/types'
import { warn } from '@/utils/log' import { warn } from '@/utils/log'
@ -8,7 +9,7 @@ import { isHttpUrl } from '@/utils/is'
export type LayoutMapKey = 'LAYOUT' export type LayoutMapKey = 'LAYOUT'
const IFRAME = () => import('@/views/base/iframe/FrameBlank.vue') const IFRAME = () => import('@/views/base/iframe/FrameBlank.vue')
const LayoutMap = new Map<string, () => Promise<typeof import('*.vue')>>() const LayoutMap = new Map<string, () => Promise<Component>>()
LayoutMap.set('LAYOUT', LAYOUT) LayoutMap.set('LAYOUT', LAYOUT)
LayoutMap.set('IFRAME', IFRAME) LayoutMap.set('IFRAME', IFRAME)

4
src/router/types.ts

@ -1,8 +1,8 @@
import type { RouteMeta, RouteRecordRaw } from 'vue-router' import type { RouteMeta, RouteRecordRaw } from 'vue-router'
import type { defineComponent } from 'vue' import type { Component as VueComponent, defineComponent } from 'vue'
import type { RoleEnum } from '@/enums/roleEnum' import type { RoleEnum } from '@/enums/roleEnum'
export type Component<T = any> = ReturnType<typeof defineComponent> | (() => Promise<typeof import('*.vue')>) | (() => Promise<T>) export type Component<T = any> = ReturnType<typeof defineComponent> | (() => Promise<VueComponent>) | (() => Promise<T>)
export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta' | 'children'> { export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta' | 'children'> {
keepAlive?: boolean keepAlive?: boolean

10
src/types/module.d.ts vendored

@ -1,9 +1,9 @@
declare module '*.vue' { // declare module '*.vue' {
import type { DefineComponent } from 'vue' // import type { DefineComponent } from 'vue'
const Component: DefineComponent<object, object, any> // const Component: DefineComponent<object, object, any>
export default Component // export default Component
} // }
declare module 'ant-design-vue/es/locale/*' { declare module 'ant-design-vue/es/locale/*' {
import type { Locale } from 'ant-design-vue/types/locale-provider' import type { Locale } from 'ant-design-vue/types/locale-provider'