Skip to content

Commit 4897920

Browse files
fix(ui): update GlobalComponents augment (fix:  #17416)
to ensure Volar correctly picks up Quasar components and provides IntelliSense for them
1 parent 6b4e280 commit 4897920

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

ui/build/build.types.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -640,14 +640,23 @@ function getIndexDts (apis, quasarLangIndex) {
640640
writeLine(contents)
641641

642642
// Provide `GlobalComponents`, expected to be used for Volar
643-
writeLine(contents, 'declare module \'@vue/runtime-core\' {')
644-
writeLine(contents, 'interface GlobalComponents {', 1)
645-
643+
// See: https://github.com/vuejs/language-tools/issues/4170#issuecomment-2025528945
644+
writeLine(contents, 'interface _GlobalComponents {')
646645
for (const [ typeName, { props: propsTypeName, slots: slotsTypeName } ] of Object.entries(componentToSubTypeMap)) {
647-
writeLine(contents, `${ typeName }: GlobalComponentConstructor<${ propsTypeName }, ${ slotsTypeName }>`, 2)
646+
writeLine(contents, `${ typeName }: GlobalComponentConstructor<${ propsTypeName }, ${ slotsTypeName }>`, 1)
648647
}
649-
650-
writeLine(contents, '}', 1)
648+
writeLine(contents, '}')
649+
writeLine(contents)
650+
writeLine(contents, 'declare module \'@vue/runtime-core\' {')
651+
writeLine(contents, 'interface GlobalComponents extends _GlobalComponents {}', 1)
652+
writeLine(contents, '}')
653+
writeLine(contents)
654+
writeLine(contents, 'declare module \'@vue/runtime-dom\' {')
655+
writeLine(contents, 'interface GlobalComponents extends _GlobalComponents {}', 1)
656+
writeLine(contents, '}')
657+
writeLine(contents)
658+
writeLine(contents, 'declare module \'vue\' {')
659+
writeLine(contents, 'interface GlobalComponents extends _GlobalComponents {}', 1)
651660
writeLine(contents, '}')
652661
writeLine(contents)
653662

0 commit comments

Comments
 (0)