10000 fix: extends types to `vue` instead of `@vue/runtime-core` by wenfangdu · Pull Request #638 · unplugin/unplugin-vue-components · GitHub
[go: up one dir, main page]

Skip to content

fix: extends types to vue instead of @vue/runtime-core #638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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