@@ -318,19 +318,21 @@ function* generateSetupFunction(
318318 yield * generateScriptSectionPartiallyEnding ( scriptSetup . name , scriptSetup . content . length , '#3632/scriptSetup.vue' ) ;
319319 yield * generateMacros ( options , ctx ) ;
320320
321- yield * generateComponentProps ( options , ctx , scriptSetup , scriptSetupRanges ) ;
321+ const hasSlots = ! ! (
322+ scriptSetupRanges . defineSlots
323+ || options . templateCodegen ?. slots . length
324+ || options . templateCodegen ?. dynamicSlots . length
325+ ) ;
326+
327+ yield * generateComponentProps ( options , ctx , scriptSetup , scriptSetupRanges , hasSlots ) ;
322328 yield * generateModelEmit ( scriptSetup , scriptSetupRanges ) ;
323329 yield * generateTemplate ( options , ctx ) ;
324330
325331 if ( syntax ) {
326332 const prefix = syntax === 'return'
327333 ? [ `return ` ]
328334 : generateConstExport ( scriptSetup ) ;
329- if (
330- scriptSetupRanges . defineSlots
331- || options . templateCodegen ?. slots . length
332- || options . templateCodegen ?. dynamicSlots . length
333- ) {
335+ if ( hasSlots ) {
334336 yield `const __VLS_base = ` ;
335337 yield * generateComponent ( options , ctx , scriptSetup , scriptSetupRanges ) ;
336338 yield endOfLine ;
@@ -439,6 +441,7 @@ function* generateComponentProps(
439441 ctx : ScriptCodegenContext ,
440442 scriptSetup : NonNullable < Sfc [ 'scriptSetup' ] > ,
441443 scriptSetupRanges : ScriptSetupRanges ,
444+ hasSlots : boolean ,
442445) : Generator < Code > {
443446 if ( scriptSetupRanges . defineProps ?. typeArg && scriptSetupRanges . withDefaults ?. arg ) {
444447 yield `const __VLS_defaults = ` ;
@@ -467,7 +470,7 @@ function* generateComponentProps(
467470 }
468471
469472 const propTypes : string [ ] = [ ] ;
470- if ( scriptSetupRanges . defineSlots && options . vueCompilerOptions . jsxSlots ) {
473+ if ( options . vueCompilerOptions . jsxSlots && hasSlots ) {
471474 propTypes . push ( `${ ctx . localTypes . PropsChildren } <__VLS_Slots>` ) ;
472475 }
473476 if ( scriptSetupRanges . defineProps ?. typeArg ) {
0 commit comments