8000 fix: extends types to `vue` instead of `@vue/runtime-core` (#638) · reslear/unplugin-vue-components@efe0a87 · GitHub
[go: up one dir, main page]

Skip to content

Commit efe0a87

Browse files
authored
fix: extends types to vue instead of @vue/runtime-core (unplugin#638)
1 parent 8451280 commit efe0a87

File tree

3 files changed

+11
-29
lines changed

3 files changed

+11
-29
lines changed

src/core/declaration.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,9 @@ export function getDeclaration(ctx: Context, filepath: string, originalImports?:
118118
? `export {}
119119
120120
declare module 'vue' {`
121-
: `import '@vue/runtime-core'
121+
: `export {}
122122
123-
export {}
124-
125-
declare module '@vue/runtime-core' {`
123+
declare module 'vue' {`
126124

127125
let code = `/* eslint-disable */
128126
/* prettier-ignore */

test/__snapshots__/dts.test.ts.snap

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ exports[`dts > components only 1`] = `
66
// @ts-nocheck
77< 8000 /code>
// Generated by unplugin-vue-components
88
// Read more: https://github.com/vuejs/core/pull/3399
9-
import '@vue/runtime-core'
10-
119
export {}
1210
13-
declare module '@vue/runtime-core' {
11+
declare module 'vue' {
1412
export interface GlobalComponents {
1513
RouterLink: typeof import('vue-router')['RouterLink']
1614
RouterView: typeof import('vue-router')['RouterView']
@@ -26,11 +24,9 @@ exports[`dts > directive only 1`] = `
2624
// @ts-nocheck
2725
// Generated by unplugin-vue-components
2826
// Read more: https://github.com/vuejs/core/pull/3399
29-
import '@vue/runtime-core'
30-
3127
export {}
3228
33-
declare module '@vue/runtime-core' {
29+
declare module 'vue' {
3430
export interface ComponentCustomProperties {
3531
vLoading: typeof import('test/directive/Loading')['default']
3632
}
@@ -44,11 +40,9 @@ exports[`dts > getDeclaration 1`] = `
4440
// @ts-nocheck
4541
// Generated by unplugin-vue-components
4642
// Read more: https://github.com/vuejs/core/pull/3399
47-
import '@vue/runtime-core'
48-
4943
export {}
5044
51-
declare module '@vue/runtime-core' {
45+
declare module 'vue' {
5246
export interface GlobalComponents {
5347
RouterLink: typeof import('vue-router')['RouterLink']
5448
RouterView: typeof import('vue-router')['RouterView']
@@ -122,11 +116,9 @@ exports[`dts > writeDeclaration - keep unused 1`] = `
122116
// @ts-nocheck
123117
// Generated by unplugin-vue-components
124118
// Read more: https://github.com/vuejs/core/pull/3399
125-
import '@vue/runtime-core'
126-
127119
export {}
128120
129-
declare module '@vue/runtime-core' {
121+
declare module 'vue' {
130122
export interface GlobalComponents {
131123
RouterLink: typeof import('vue-router')['RouterLink']
132124
RouterView: typeof import('vue-router')['RouterView']
@@ -148,11 +140,9 @@ exports[`dts > writeDeclaration 1`] = `
148140
// @ts-nocheck
149141
// Generated by unplugin-vue-components
150142
// Read more: https://github.com/vuejs/core/pull/3399
151-
import '@vue/runtime-core'
152-
153143
export {}
154144
155-
declare module '@vue/runtime-core' {
145+
declare module 'vue' {
156146
export interface GlobalComponents {
157147
RouterLink: typeof import('vue-router')['RouterLink']
158148
RouterView: typeof import('vue-router')['RouterView']

test/dts.test.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const _directive_loading = _resolveDirective("loading")`
5252
await writeFile(
5353
filepath,
5454
`
55-
declare module '@vue/runtime-core' {
55+
declare module 'vue' {
5656
export interface GlobalComponents {
5757
SomeComp: typeof import('test/component/SomeComp')['default']
5858
TestComp: typeof import('test/component/OldComp')['default']
@@ -128,11 +128,9 @@ const _directive_loading = _resolveDirective("loading")`
128128
// generated by unplugin-vue-components
129129
// We suggest you to commit this file into source control
130130
// Read more: https://github.com/vuejs/core/pull/3399
131-
import '@vue/runtime-core'
132-
133131
export {}
134132
135-
declare module '@vue/runtime-core' {
133+
declare module 'vue' {
136134
export interface GlobalComponents {
137135
ComponentA: typeof import('./src/components/ComponentA.vue')['default']
138136
ComponentB: typeof import('./src/components/ComponentB.vue')['default']
@@ -151,11 +149,9 @@ declare module '@vue/runtime-core' {
151149
// generated by unplugin-vue-components
152150
// We suggest you to commit this file into source control
153151
// Read more: https://github.com/vuejs/core/pull/3399
154-
import '@vue/runtime-core'
155-
156152
export {}
157153
158-
declare module '@vue/runtime-core' {
154+
declare module 'vue' {
159155
export interface GlobalComponents {
160156
ComponentA: typeof import('./src/components/ComponentA.vue')['default']
161157
'IMdi:diceD12': typeof import('~icons/mdi/dice-d12')['default']
@@ -174,11 +170,9 @@ declare module '@vue/runtime-core' {
174170
// generated by unplugin-vue-components
175171
// We suggest you to commit this file into source control
176172
// Read more: https://github.com/vuejs/core/pull/3399
177-
import '@vue/runtime-core'
178-
179173
export {}
180174
181-
declare module '@vue/runtime-core' {
175+
declare module 'vue' {
182176
export interface GlobalComponents {
183177
ComponentA: typeof import('./src/components/ComponentA.vue')['default']
184178
'IMdi:diceD12': typeof import('~icons/mdi/dice-d12')['default']

0 commit comments

Comments
 (0)
0