@@ -52,6 +52,7 @@ export function* generateGeneric(
5252 yield * body ;
5353
5454 const propTypes : string [ ] = [ ] ;
55+ const emitTypes : string [ ] = [ ] ;
5556 const { vueCompilerOptions } = options ;
5657
5758 if ( ctx . generatedTypes . has ( names . PublicProps ) ) {
@@ -78,8 +79,6 @@ export function* generateGeneric(
7879 if ( options . templateCodegen ?. generatedTypes . has ( names . InheritedAttrs ) ) {
7980 propTypes . push ( names . InheritedAttrs ) ;
8081 }
81-
82- const emitTypes : string [ ] = [ ] ;
8382 if ( scriptSetupRanges . defineEmits ) {
8483 emitTypes . push ( `typeof ${ scriptSetupRanges . defineEmits . name ?? names . emit } ` ) ;
8584 }
@@ -88,15 +87,17 @@ export function* generateGeneric(
8887 }
8988
9089 yield `return {} as {${ newLine } ` ;
91- yield ` props: ${ propTypes . length ? `${ ctx . localTypes . PrettifyLocal } <${ propTypes . join ( ` & ` ) } > & ` : `` } ${
92- vueCompilerOptions . target >= 3.4
93- ? `import('${ vueCompilerOptions . lib } ').PublicProps`
94- : vueCompilerOptions . target >= 3
95- ? `import('${ vueCompilerOptions . lib } ').VNodeProps`
96- + ` & import('${ vueCompilerOptions . lib } ').AllowedComponentProps`
97- + ` & import('${ vueCompilerOptions . lib } ').ComponentCustomProps`
98- : `globalThis.JSX.IntrinsicAttributes`
99- } `;
90+ yield ` props: ` ;
91+ yield vueCompilerOptions . target >= 3.4
92+ ? `import('${ vueCompilerOptions . lib } ').PublicProps`
93+ : vueCompilerOptions . target >= 3
94+ ? `import('${ vueCompilerOptions . lib } ').VNodeProps`
95+ + ` & import('${ vueCompilerOptions . lib } ').AllowedComponentProps`
96+ + ` & import('${ vueCompilerOptions . lib } ').ComponentCustomProps`
97+ : `globalThis.JSX.IntrinsicAttributes` ;
98+ if ( propTypes . length ) {
99+ yield ` & ${ ctx . localTypes . PrettifyLocal } <${ propTypes . join ( ` & ` ) } >` ;
100+ }
100101 if ( ! vueCompilerOptions . checkUnknownProps ) {
101102 yield ` & (typeof globalThis extends { ${ names . PROPS_FALLBACK } : infer P } ? P : {})` ;
102103 }
0 commit comments