@@ -318,18 +318,6 @@ function* generateSetupFunction(
318318 yield * generateScriptSectionPartiallyEnding ( scriptSetup . name , scriptSetup . content . length , '#3632/scriptSetup.vue' ) ;
319319 yield * generateMacros ( options , ctx ) ;
320320
321- if ( scriptSetupRanges . defineProps ?. typeArg && scriptSetupRanges . withDefaults ?. arg ) {
322- // fix https://github.com/vuejs/language-tools/issues/1187
323- yield `const __VLS_defaults = (function <T>(t: T) { return t })(` ;
324- yield generateSfcBlockSection (
325- scriptSetup ,
326- scriptSetupRanges . withDefaults . arg . start ,
327- scriptSetupRanges . withDefaults . arg . end ,
328- codeFeatures . navigation ,
329- ) ;
330- yield `)${ endOfLine } ` ;
331- }
332-
333321 yield * generateComponentProps ( options , ctx , scriptSetup , scriptSetupRanges ) ;
334322 yield * generateModelEmit ( scriptSetup , scriptSetupRanges ) ;
335323 yield * generateTemplate ( options , ctx ) ;
@@ -452,6 +440,17 @@ function* generateComponentProps(
452440 scriptSetup : NonNullable < Sfc [ 'scriptSetup' ] > ,
453441 scriptSetupRanges : ScriptSetupRanges ,
454442) : Generator < Code > {
443+ if ( scriptSetupRanges . defineProps ?. typeArg && scriptSetupRanges . withDefaults ?. arg ) {
444+ yield `const __VLS_defaults = ` ;
445+ yield generateSfcBlockSection (
446+ scriptSetup ,
447+ scriptSetupRanges . withDefaults . arg . start ,
448+ scriptSetupRanges . withDefaults . arg . end ,
449+ codeFeatures . navigation ,
450+ ) ;
451+ yield endOfLine ;
452+ }
453+
455454 if ( scriptSetupRanges . defineModel . length ) {
456455 yield `const __VLS_defaultModels = {${ newLine } ` ;
457456 for ( const defineModel of scriptSetupRanges . defineModel ) {
0 commit comments