Skip to content

Commit 6f1134f

Browse files
committed
refactor: Change the path of the global declaration
1 parent c15c884 commit 6f1134f

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

auto-imports.d.ts renamed to src/auto-imports.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ declare global {
5151
const readonly: typeof import('vue')['readonly']
5252
const ref: typeof import('vue')['ref']
5353
const resolveComponent: typeof import('vue')['resolveComponent']
54-
const resolveDirective: typeof import('vue')['resolveDirective']
5554
const shallowReactive: typeof import('vue')['shallowReactive']
5655
const shallowReadonly: typeof import('vue')['shallowReadonly']
5756
const shallowRef: typeof import('vue')['shallowRef']

components.d.ts renamed to src/components.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ export {}
77

88
declare module 'vue' {
99
export interface GlobalComponents {
10-
Chart: typeof import('./src/components/chart/index.vue')['default']
10+
Chart: typeof import('./components/chart/index.vue')['default']
11+
RouterLink: typeof import('vue-router')['RouterLink']
12+
RouterView: typeof import('vue-router')['RouterView']
1113
VanButton: typeof import('vant/es')['Button']
1214
VanCell: typeof import('vant/es')['Cell']
1315
VanCellGroup: typeof import('vant/es')['CellGroup']

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
"src/**/*.vue",
3131
"tests/**/*.ts",
3232
"tests/**/*.tsx",
33-
"components.d.ts",
34-
"auto-imports.d.ts",
33+
"src/components.d.ts",
34+
"src/auto-imports.d.ts",
3535
"tests/*.ts"
3636
]
3737
}

vite.config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
3939
}),
4040

4141
Components({
42-
dts: true,
42+
extensions: ['vue'],
4343
resolvers: [VantResolver()],
44-
types: [],
44+
include: [/\.vue$/, /\.vue\?vue/],
45+
dts: 'src/components.d.ts',
4546
}),
4647

4748
AutoImport({
@@ -55,7 +56,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
5556
'vue-router',
5657
'vitest',
5758
],
58-
dts: true,
59+
dts: 'src/auto-imports.d.ts',
5960
}),
6061

6162
viteVConsole({

0 commit comments

Comments
 (0)