Skip to content

Commit

Permalink
fix: extends types to vue instead of @vue/runtime-core (#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
wenfangdu committed Jun 5, 2023
1 parent 8451280 commit efe0a87
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 29 deletions.
6 changes: 2 additions & 4 deletions src/core/declaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,9 @@ export function getDeclaration(ctx: Context, filepath: string, originalImports?:
? `export {}
declare module 'vue' {`
: `import '@vue/runtime-core'
: `export {}
export {}
declare module '@vue/runtime-core' {`
declare module 'vue' {`

let code = `/* eslint-disable */
/* prettier-ignore */
Expand Down
20 changes: 5 additions & 15 deletions test/__snapshots__/dts.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ exports[`dts > components only 1`] = `
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
export {}
declare module '@vue/runtime-core' {
declare module 'vue' {
export interface GlobalComponents {
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Expand All @@ -26,11 +24,9 @@ exports[`dts > directive only 1`] = `
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
export {}
declare module '@vue/runtime-core' {
declare module 'vue' {
export interface ComponentCustomProperties {
vLoading: typeof import('test/directive/Loading')['default']
}
Expand All @@ -44,11 +40,9 @@ exports[`dts > getDeclaration 1`] = `
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
export {}
declare module '@vue/runtime-core' {
declare module 'vue' {
export interface GlobalComponents {
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Expand Down Expand Up @@ -122,11 +116,9 @@ exports[`dts > writeDeclaration - keep unused 1`] = `
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
export {}
declare module '@vue/runtime-core' {
declare module 'vue' {
export interface GlobalComponents {
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Expand All @@ -148,11 +140,9 @@ exports[`dts > writeDeclaration 1`] = `
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
export {}
declare module '@vue/runtime-core' {
declare module 'vue' {
export interface GlobalComponents {
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Expand Down
14 changes: 4 additions & 10 deletions test/dts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const _directive_loading = _resolveDirective("loading")`
await writeFile(
filepath,
`
declare module '@vue/runtime-core' {
declare module 'vue' {
export interface GlobalComponents {
SomeComp: typeof import('test/component/SomeComp')['default']
TestComp: typeof import('test/component/OldComp')['default']
Expand Down Expand Up @@ -128,11 +128,9 @@ const _directive_loading = _resolveDirective("loading")`
// generated by unplugin-vue-components
// We suggest you to commit this file into source control
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
export {}
declare module '@vue/runtime-core' {
declare module 'vue' {
export interface GlobalComponents {
ComponentA: typeof import('./src/components/ComponentA.vue')['default']
ComponentB: typeof import('./src/components/ComponentB.vue')['default']
Expand All @@ -151,11 +149,9 @@ declare module '@vue/runtime-core' {
// generated by unplugin-vue-components
// We suggest you to commit this file into source control
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
export {}
declare module '@vue/runtime-core' {
declare module 'vue' {
export interface GlobalComponents {
ComponentA: typeof import('./src/components/ComponentA.vue')['default']
'IMdi:diceD12': typeof import('~icons/mdi/dice-d12')['default']
Expand All @@ -174,11 +170,9 @@ declare module '@vue/runtime-core' {
// generated by unplugin-vue-components
// We suggest you to commit this file into source control
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
export {}
declare module '@vue/runtime-core' {
declare module 'vue' {
export interface GlobalComponents {
ComponentA: typeof import('./src/components/ComponentA.vue')['default']
'IMdi:diceD12': typeof import('~icons/mdi/dice-d12')['default']
Expand Down

0 comments on commit efe0a87

Please sign in to comment.