fix(nuxt): augment interfaces exported from vue (#18505)

This commit is contained in:
Daniel Roe 2023-01-25 07:59:02 -08:00 committed by GitHub
parent 026511b697
commit 7d812db9e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -124,7 +124,7 @@ declare module '#app' {
} }
} }
declare module '@vue/runtime-core' { declare module 'vue' {
interface ComponentCustomProperties { interface ComponentCustomProperties {
$hello (msg: string): string $hello (msg: string): string
} }

View File

@ -17,7 +17,7 @@ declare global {
} }
} }
declare module '@vue/runtime-core' { declare module 'vue' {
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
interface App<HostElement> { interface App<HostElement> {
$nuxt: NuxtApp $nuxt: NuxtApp

View File

@ -114,7 +114,7 @@ export const componentsTypeTemplate: NuxtTemplate<ComponentsTemplateContext> = {
]) ])
return `// Generated by components discovery return `// Generated by components discovery
declare module '@vue/runtime-core' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {
${componentTypes.map(([pascalName, type]) => ` '${pascalName}': ${type}`).join('\n')} ${componentTypes.map(([pascalName, type]) => ` '${pascalName}': ${type}`).join('\n')}
${componentTypes.map(([pascalName, type]) => ` 'Lazy${pascalName}': ${type}`).join('\n')} ${componentTypes.map(([pascalName, type]) => ` 'Lazy${pascalName}': ${type}`).join('\n')}

View File

@ -17,7 +17,7 @@ export const vueShim: NuxtTemplate = {
getContents: () => getContents: () =>
[ [
'declare module \'*.vue\' {', 'declare module \'*.vue\' {',
' import { DefineComponent } from \'@vue/runtime-core\'', ' import { DefineComponent } from \'vue\'',
' const component: DefineComponent<{}, {}, any>', ' const component: DefineComponent<{}, {}, any>',
' export default component', ' export default component',
'}' '}'
@ -102,7 +102,7 @@ declare module '#app' {
interface NuxtApp extends NuxtAppInjections { } interface NuxtApp extends NuxtAppInjections { }
} }
declare module '@vue/runtime-core' { declare module 'vue' {
interface ComponentCustomProperties extends NuxtAppInjections { } interface ComponentCustomProperties extends NuxtAppInjections { }
} }