@@ -66,7 +66,7 @@ export function* generateScriptSetup(
66
66
}
67
67
68
68
yield `return {} as {${ newLine } `
69
- + ` props: ${ ctx . localTypes . PrettifyLocal } <typeof __VLS_functionalComponentProps & __VLS_TemplateResult['attrs'] & __VLS_PublicProps > & __VLS_BuiltInPublicProps,${ newLine } `
69
+ + ` props: ${ ctx . localTypes . PrettifyLocal } <__VLS_OwnProps & __VLS_PublicProps & __VLS_TemplateResult['attrs']> & __VLS_BuiltInPublicProps,${ newLine } `
70
70
+ ` expose(exposed: import('${ options . vueCompilerOptions . lib } ').ShallowUnwrapRef<${ scriptSetupRanges . defineExpose ? 'typeof __VLS_exposed' : '{}' } >): void,${ newLine } `
71
71
+ ` attrs: any,${ newLine } `
72
72
+ ` slots: __VLS_TemplateResult['slots'],${ newLine } `
@@ -368,37 +368,39 @@ function* generateComponentProps(
368
368
scriptSetup : NonNullable < Sfc [ 'scriptSetup' ] > ,
369
369
scriptSetupRanges : ScriptSetupRanges
370
370
) : Generator < Code > {
371
- yield `const __VLS_fnComponent = (await import('${ options . vueCompilerOptions . lib } ')).defineComponent({${ newLine } ` ;
372
-
373
- if ( scriptSetupRanges . defineProps ?. arg ) {
374
- yield `props: ` ;
375
- yield generateSfcBlockSection (
376
- scriptSetup ,
377
- scriptSetupRanges . defineProps . arg . start ,
378
- scriptSetupRanges . defineProps . arg . end ,
379
- codeFeatures . navigation
380
- ) ;
381
- yield `,${ newLine } ` ;
371
+ if ( scriptSetup . generic ) {
372
+ yield `const __VLS_fnComponent = (await import('${ options . vueCompilerOptions . lib } ')).defineComponent({${ newLine } ` ;
373
+
374
+ if ( scriptSetupRanges . defineProps ?. arg ) {
375
+ yield `props: ` ;
376
+ yield generateSfcBlockSection (
377
+ scriptSetup ,
378
+ scriptSetupRanges . defineProps . arg . start ,
379
+ scriptSetupRanges . defineProps . arg . end ,
380
+ codeFeatures . navigation
381
+ ) ;
382
+ yield `,${ newLine } ` ;
383
+ }
384
+
385
+ yield * generateEmitsOption ( options , scriptSetupRanges ) ;
386
+
387
+ yield `})${ endOfLine } ` ;
388
+
389
+ yield `type __VLS_BuiltInPublicProps = ${ options . vueCompilerOptions . target >= 3.4
390
+ ? `import('${ options . vueCompilerOptions . lib } ').PublicProps`
391
+ : options . vueCompilerOptions . target >= 3.0
392
+ ? `import('${ options . vueCompilerOptions . lib } ').VNodeProps`
393
+ + ` & import('${ options . vueCompilerOptions . lib } ').AllowedComponentProps`
394
+ + ` & import('${ options . vueCompilerOptions . lib } ').ComponentCustomProps`
395
+ : `globalThis.JSX.IntrinsicAttributes`
396
+ } `;
397
+ yield endOfLine ;
398
+
399
+ yield `type __VLS_OwnProps = ` ;
400
+ yield `${ ctx . localTypes . OmitKeepDiscriminatedUnion } <InstanceType<typeof __VLS_fnComponent>['$props'], keyof __VLS_BuiltInPublicProps>` ;
401
+ yield endOfLine ;
382
402
}
383
403
384
- yield * generateEmitsOption ( options , scriptSetupRanges ) ;
385
-
386
- yield `})${ endOfLine } ` ;
387
-
388
- yield `type __VLS_BuiltInPublicProps = ${ options . vueCompilerOptions . target >= 3.4
389
- ? `import('${ options . vueCompilerOptions . lib } ').PublicProps`
390
- : options . vueCompilerOptions . target >= 3.0
391
- ? `import('${ options . vueCompilerOptions . lib } ').VNodeProps`
392
- + ` & import('${ options . vueCompilerOptions . lib } ').AllowedComponentProps`
393
- + ` & import('${ options . vueCompilerOptions . lib } ').ComponentCustomProps`
394
- : `globalThis.JSX.IntrinsicAttributes`
395
- } `;
396
- yield endOfLine ;
397
-
398
- yield `let __VLS_functionalComponentProps!: ` ;
399
- yield `${ ctx . localTypes . OmitKeepDiscriminatedUnion } <InstanceType<typeof __VLS_fnComponent>['$props'], keyof __VLS_BuiltInPublicProps>` ;
400
- yield endOfLine ;
401
-
402
404
if ( scriptSetupRanges . defineProp . length ) {
403
405
yield `const __VLS_defaults = {${ newLine } ` ;
404
406
for ( const defineProp of scriptSetupRanges . defineProp ) {
0 commit comments