chore: optimize dts imports (#18051)

* feat: move /typings/components.d.ts to /typings/global.d.ts

* feat: use /typings/global.d.ts file

* chore: adjust the order for global.d.ts
This commit is contained in:
DDDDD12138 2024-09-03 14:34:21 +08:00 committed by GitHub
parent cf23d10912
commit 60cb2262f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 6 additions and 125 deletions

View File

@ -15,7 +15,7 @@
"element-plus": ["../packages/element-plus"], "element-plus": ["../packages/element-plus"],
"~/*": ["./.vitepress/vitepress/*"] "~/*": ["./.vitepress/vitepress/*"]
}, },
"types": ["../typings/components"], "types": ["../typings/global"],
"jsx": "preserve" "jsx": "preserve"
}, },
"include": ["**/*", ".vitepress/**/*"], "include": ["**/*", ".vitepress/**/*"],

View File

@ -20,7 +20,7 @@ export const copyFiles = () =>
path.resolve(epOutput, 'README.md') path.resolve(epOutput, 'README.md')
), ),
copyFile( copyFile(
path.resolve(projRoot, 'global.d.ts'), path.resolve(projRoot, 'typings', 'global.d.ts'),
path.resolve(epOutput, 'global.d.ts') path.resolve(epOutput, 'global.d.ts')
), ),
]) ])

View File

@ -16,7 +16,8 @@
"rootDir": ".", "rootDir": ".",
"types": [], "types": [],
"paths": { "paths": {
"@element-plus/*": ["packages/*"] "@element-plus/*": ["packages/*"],
"element-plus": ["packages/element-plus"]
}, },
"preserveSymlinks": true "preserveSymlinks": true
} }

View File

@ -6,7 +6,7 @@
}, },
"include": [ "include": [
"packages", "packages",
"typings/components.d.ts", "typings/global.d.ts",
"typings/env.d.ts", "typings/env.d.ts",
// playground // playground

View File

@ -1,120 +0,0 @@
declare module 'vue' {
// GlobalComponents for Volar
export interface GlobalComponents {
ElAffix: typeof import('../packages/element-plus')['ElAffix']
ElAlert: typeof import('../packages/element-plus')['ElAlert']
ElAside: typeof import('../packages/element-plus')['ElAside']
ElAutocomplete: typeof import('../packages/element-plus')['ElAutocomplete']
ElAvatar: typeof import('../packages/element-plus')['ElAvatar']
ElBacktop: typeof import('../packages/element-plus')['ElBacktop']
ElBadge: typeof import('../packages/element-plus')['ElBadge']
ElBreadcrumb: typeof import('../packages/element-plus')['ElBreadcrumb']
ElBreadcrumbItem: typeof import('../packages/element-plus')['ElBreadcrumbItem']
ElButton: typeof import('../packages/element-plus')['ElButton']
ElButtonGroup: typeof import('../packages/element-plus')['ElButtonGroup']
ElCalendar: typeof import('../packages/element-plus')['ElCalendar']
ElCard: typeof import('../packages/element-plus')['ElCard']
ElCarousel: typeof import('../packages/element-plus')['ElCarousel']
ElCarouselItem: typeof import('../packages/element-plus')['ElCarouselItem']
ElCascader: typeof import('../packages/element-plus')['ElCascader']
ElCascaderPanel: typeof import('../packages/element-plus')['ElCascaderPanel']
ElCheckbox: typeof import('../packages/element-plus')['ElCheckbox']
ElCheckboxButton: typeof import('../packages/element-plus')['ElCheckboxButton']
ElCheckboxGroup: typeof import('../packages/element-plus')['ElCheckboxGroup']
ElCol: typeof import('../packages/element-plus')['ElCol']
ElCollapse: typeof import('../packages/element-plus')['ElCollapse']
ElCollapseItem: typeof import('../packages/element-plus')['ElCollapseItem']
ElCollapseTransition: typeof import('../packages/element-plus')['ElCollapseTransition']
ElColorPicker: typeof import('../packages/element-plus')['ElColorPicker']
ElContainer: typeof import('../packages/element-plus')['ElContainer']
ElConfigProvider: typeof import('../packages/element-plus')['ElConfigProvider']
ElDatePicker: typeof import('../packages/element-plus')['ElDatePicker']
ElDialog: typeof import('../packages/element-plus')['ElDialog']
ElDivider: typeof import('../packages/element-plus')['ElDivider']
ElDrawer: typeof import('../packages/element-plus')['ElDrawer']
ElDropdown: typeof import('../packages/element-plus')['ElDropdown']
ElDropdownItem: typeof import('../packages/element-plus')['ElDropdownItem']
ElDropdownMenu: typeof import('../packages/element-plus')['ElDropdownMenu']
ElEmpty: typeof import('../packages/element-plus')['ElEmpty']
ElFooter: typeof import('../packages/element-plus')['ElFooter']
ElForm: typeof import('../packages/element-plus')['ElForm']
ElFormItem: typeof import('../packages/element-plus')['ElFormItem']
ElHeader: typeof import('../packages/element-plus')['ElHeader']
ElIcon: typeof import('../packages/element-plus')['ElIcon']
ElImage: typeof import('../packages/element-plus')['ElImage']
ElImageViewer: typeof import('../packages/element-plus')['ElImageViewer']
ElInput: typeof import('../packages/element-plus')['ElInput']
ElInputNumber: typeof import('../packages/element-plus')['ElInputNumber']
ElLink: typeof import('../packages/element-plus')['ElLink']
ElMain: typeof import('../packages/element-plus')['ElMain']
ElMenu: typeof import('../packages/element-plus')['ElMenu']
ElMenuItem: typeof import('../packages/element-plus')['ElMenuItem']
ElMenuItemGroup: typeof import('../packages/element-plus')['ElMenuItemGroup']
ElOption: typeof import('../packages/element-plus')['ElOption']
ElOptionGroup: typeof import('../packages/element-plus')['ElOptionGroup']
ElPageHeader: typeof import('../packages/element-plus')['ElPageHeader']
ElPagination: typeof import('../packages/element-plus')['ElPagination']
ElPopconfirm: typeof import('../packages/element-plus')['ElPopconfirm']
ElPopper: typeof import('../packages/element-plus')['ElPopper']
ElPopover: typeof import('../packages/element-plus')['ElPopover']
ElProgress: typeof import('../packages/element-plus')['ElProgress']
ElRadio: typeof import('../packages/element-plus')['ElRadio']
ElRadioButton: typeof import('../packages/element-plus')['ElRadioButton']
ElRadioGroup: typeof import('../packages/element-plus')['ElRadioGroup']
ElRate: typeof import('../packages/element-plus')['ElRate']
ElRow: typeof import('../packages/element-plus')['ElRow']
ElScrollbar: typeof import('../packages/element-plus')['ElScrollbar']
ElSelect: typeof import('../packages/element-plus')['ElSelect']
ElSlider: typeof import('../packages/element-plus')['ElSlider']
ElStep: typeof import('../packages/element-plus')['ElStep']
ElSteps: typeof import('../packages/element-plus')['ElSteps']
ElSubMenu: typeof import('../packages/element-plus')['ElSubMenu']
ElSwitch: typeof import('../packages/element-plus')['ElSwitch']
ElTabPane: typeof import('../packages/element-plus')['ElTabPane']
ElTable: typeof import('../packages/element-plus')['ElTable']
ElTableColumn: typeof import('../packages/element-plus')['ElTableColumn']
ElTabs: typeof import('../packages/element-plus')['ElTabs']
ElTag: typeof import('../packages/element-plus')['ElTag']
ElText: typeof import('../packages/element-plus')['ElText']
ElTimePicker: typeof import('../packages/element-plus')['ElTimePicker']
ElTimeSelect: typeof import('../packages/element-plus')['ElTimeSelect']
ElTimeline: typeof import('../packages/element-plus')['ElTimeline']
ElTimelineItem: typeof import('../packages/element-plus')['ElTimelineItem']
ElTooltip: typeof import('../packages/element-plus')['ElTooltip']
ElTransfer: typeof import('../packages/element-plus')['ElTransfer']
ElTree: typeof import('../packages/element-plus')['ElTree']
ElTreeV2: typeof import('../packages/element-plus')['ElTreeV2']
ElTreeSelect: typeof import('../packages/element-plus')['ElTreeSelect']
ElUpload: typeof import('../packages/element-plus')['ElUpload']
ElSpace: typeof import('../packages/element-plus')['ElSpace']
ElSkeleton: typeof import('../packages/element-plus')['ElSkeleton']
ElSkeletonItem: typeof import('../packages/element-plus')['ElSkeletonItem']
ElStatistic: typeof import('../packages/element-plus')['ElStatistic']
ElCountdown: typeof import('../packages/element-plus')['ElCountdown']
ElCheckTag: typeof import('../packages/element-plus')['ElCheckTag']
ElDescriptions: typeof import('../packages/element-plus')['ElDescriptions']
ElDescriptionsItem: typeof import('../packages/element-plus')['ElDescriptionsItem']
ElResult: typeof import('../packages/element-plus')['ElResult']
ElSelectV2: typeof import('../packages/element-plus')['ElSelectV2']
ElWatermark: typeof import('../packages/element-plus')['ElWatermark']
ElTour: typeof import('../packages/element-plus')['ElTour']
ElTourStep: typeof import('../packages/element-plus')['ElTourStep']
ElAnchor: typeof import('../packages/element-plus')['ElAnchor']
ElAnchorLink: typeof import('../packages/element-plus')['ElAnchorLink']
ElSegmented: typeof import('../packages/element-plus')['ElSegmented']
ElMention: typeof import('../packages/element-plus')['ElMention']
}
interface ComponentCustomProperties {
$message: typeof import('../packages/element-plus')['ElMessage']
$notify: typeof import('../packages/element-plus')['ElNotification']
$msgbox: typeof import('../packages/element-plus')['ElMessageBox']
$messageBox: typeof import('../packages/element-plus')['ElMessageBox']
$alert: typeof import('../packages/element-plus')['ElMessageBox']['alert']
$confirm: typeof import('../packages/element-plus')['ElMessageBox']['confirm']
$prompt: typeof import('../packages/element-plus')['ElMessageBox']['prompt']
$loading: typeof import('../packages/element-plus')['ElLoadingService']
}
}
export {}

View File

@ -1,5 +1,5 @@
// GlobalComponents for Volar
declare module 'vue' { declare module 'vue' {
// GlobalComponents for Volar
export interface GlobalComponents { export interface GlobalComponents {
ElAffix: typeof import('element-plus')['ElAffix'] ElAffix: typeof import('element-plus')['ElAffix']
ElAlert: typeof import('element-plus')['ElAlert'] ElAlert: typeof import('element-plus')['ElAlert']