From 7d812db9e826b9cab784f85337a19f86cebc23fd Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 25 Jan 2023 07:59:02 -0800 Subject: [PATCH] fix(nuxt): augment interfaces exported from `vue` (#18505) --- docs/2.guide/2.directory-structure/1.plugins.md | 2 +- packages/nuxt/src/app/types/augments.d.ts | 2 +- packages/nuxt/src/components/templates.ts | 2 +- packages/nuxt/src/core/templates.ts | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/2.guide/2.directory-structure/1.plugins.md b/docs/2.guide/2.directory-structure/1.plugins.md index 4eab3e0b52..07f339ad18 100644 --- a/docs/2.guide/2.directory-structure/1.plugins.md +++ b/docs/2.guide/2.directory-structure/1.plugins.md @@ -124,7 +124,7 @@ declare module '#app' { } } -declare module '@vue/runtime-core' { +declare module 'vue' { interface ComponentCustomProperties { $hello (msg: string): string } diff --git a/packages/nuxt/src/app/types/augments.d.ts b/packages/nuxt/src/app/types/augments.d.ts index bc158b55ad..675af7443d 100644 --- a/packages/nuxt/src/app/types/augments.d.ts +++ b/packages/nuxt/src/app/types/augments.d.ts @@ -17,7 +17,7 @@ declare global { } } -declare module '@vue/runtime-core' { +declare module 'vue' { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface App { $nuxt: NuxtApp diff --git a/packages/nuxt/src/components/templates.ts b/packages/nuxt/src/components/templates.ts index 5a714f7da5..9fac4a58a0 100644 --- a/packages/nuxt/src/components/templates.ts +++ b/packages/nuxt/src/components/templates.ts @@ -114,7 +114,7 @@ export const componentsTypeTemplate: NuxtTemplate = { ]) return `// Generated by components discovery -declare module '@vue/runtime-core' { +declare module 'vue' { export interface GlobalComponents { ${componentTypes.map(([pascalName, type]) => ` '${pascalName}': ${type}`).join('\n')} ${componentTypes.map(([pascalName, type]) => ` 'Lazy${pascalName}': ${type}`).join('\n')} diff --git a/packages/nuxt/src/core/templates.ts b/packages/nuxt/src/core/templates.ts index 1ea4d2abf3..d69a997bc0 100644 --- a/packages/nuxt/src/core/templates.ts +++ b/packages/nuxt/src/core/templates.ts @@ -17,7 +17,7 @@ export const vueShim: NuxtTemplate = { getContents: () => [ 'declare module \'*.vue\' {', - ' import { DefineComponent } from \'@vue/runtime-core\'', + ' import { DefineComponent } from \'vue\'', ' const component: DefineComponent<{}, {}, any>', ' export default component', '}' @@ -102,7 +102,7 @@ declare module '#app' { interface NuxtApp extends NuxtAppInjections { } } -declare module '@vue/runtime-core' { +declare module 'vue' { interface ComponentCustomProperties extends NuxtAppInjections { } }