@@ -114,6 +114,7 @@ ${dts}`.trim()}\n`
114114 const multilineCommentsRE = / \/ \* .* ?\* \/ / gms
115115 const singlelineCommentsRE = / \/ \/ .* $ / gm
116116 const dtsReg = / d e c l a r e \s + g l o b a l \s * { ( .* ?) [ \n \r ] } / s
117+ const componentCustomPropertiesReg = / i n t e r f a c e \s + C o m p o n e n t C u s t o m P r o p e r t i e s \s * { ( .* ?) [ \n \r ] } / gs
117118 function parseDTS ( dts : string ) {
118119 dts = dts
119120 . replace ( multilineCommentsRE , '' )
@@ -131,7 +132,7 @@ ${dts}`.trim()}\n`
131132 const dir = dirname ( file )
132133 const originalContent = existsSync ( file ) ? await fs . readFile ( file , 'utf-8' ) : ''
133134 const originalDTS = parseDTS ( originalContent )
134- const currentContent = await unimport . generateTypeDeclarations ( {
135+ let currentContent = await unimport . generateTypeDeclarations ( {
135136 resolvePath : ( i ) => {
136137 if ( i . from . startsWith ( '.' ) || isAbsolute ( i . from ) ) {
137138 const related = slash ( relative ( dir , i . from ) . replace ( / \. t s ( x ) ? $ / , '' ) )
@@ -143,6 +144,12 @@ ${dts}`.trim()}\n`
143144 } ,
144145 } )
145146 const currentDTS = parseDTS ( currentContent ) !
147+ if ( options . vueTemplate ) {
148+ currentContent = currentContent . replace (
149+ componentCustomPropertiesReg ,
150+ $1 => `interface GlobalComponents {}\n ${ $1 } ` ,
151+ )
152+ }
146153 if ( originalDTS ) {
147154 Object . keys ( currentDTS ) . forEach ( ( key ) => {
148155 originalDTS [ key ] = currentDTS [ key ]
0 commit comments