@@ -15,7 +15,6 @@ export function* generateElementEvents(
15
15
node : CompilerDOM . ElementNode ,
16
16
componentVar : string ,
17
17
componentInstanceVar : string ,
18
- emitVar : string ,
19
18
eventsVar : string
20
19
) : Generator < Code , boolean > {
21
20
let usedComponentEventsVar = false ;
@@ -34,30 +33,7 @@ export function* generateElementEvents(
34
33
yield `let ${ propsVar } !: __VLS_FunctionalComponentProps<typeof ${ componentVar } , typeof ${ componentInstanceVar } >${ endOfLine } ` ;
35
34
}
36
35
const originalPropName = camelize ( 'on-' + prop . arg . loc . source ) ;
37
- const originalPropNameObjectKey = variableNameRegex . test ( originalPropName )
38
- ? originalPropName
39
- : `'${ originalPropName } '` ;
40
- yield `const ${ ctx . getInternalVariable ( ) } : ` ;
41
- if ( ! options . vueCompilerOptions . strictTemplates ) {
42
- yield `Record<string, unknown> & ` ;
43
- }
44
- yield `(${ newLine } ` ;
45
- yield `__VLS_IsFunction<typeof ${ propsVar } , '${ originalPropName } '> extends true${ newLine } ` ;
46
- yield `? typeof ${ propsVar } ${ newLine } ` ;
47
- yield `: __VLS_IsFunction<typeof ${ eventsVar } , '${ prop . arg . loc . source } '> extends true${ newLine } ` ;
48
- yield `? {${ newLine } ` ;
49
- yield `/**__VLS_emit,${ emitVar } ,${ prop . arg . loc . source } */${ newLine } ` ;
50
- yield `${ originalPropNameObjectKey } ?: typeof ${ eventsVar } ['${ prop . arg . loc . source } ']${ newLine } ` ;
51
- yield `}${ newLine } ` ;
52
- if ( prop . arg . loc . source !== camelize ( prop . arg . loc . source ) ) {
53
- yield `: __VLS_IsFunction<typeof ${ eventsVar } , '${ camelize ( prop . arg . loc . source ) } '> extends true${ newLine } ` ;
54
- yield `? {${ newLine } ` ;
55
- yield `/**__VLS_emit,${ emitVar } ,${ camelize ( prop . arg . loc . source ) } */${ newLine } ` ;
56
- yield `${ originalPropNameObjectKey } ?: typeof ${ eventsVar } ['${ camelize ( prop . arg . loc . source ) } ']${ newLine } ` ;
57
- yield `}${ newLine } ` ;
58
- }
59
- yield `: typeof ${ propsVar } ${ newLine } ` ;
60
- yield `) = {${ newLine } ` ;
36
+ yield `const ${ ctx . getInternalVariable ( ) } : __VLS_NormalizeComponentEvent<typeof ${ propsVar } , typeof ${ eventsVar } , '${ originalPropName } ', '${ prop . arg . loc . source } ', '${ camelize ( prop . arg . loc . source ) } '> = {${ newLine } ` ;
61
37
yield * generateEventArg ( ctx , prop . arg , true ) ;
62
38
yield `: ` ;
63
39
yield * generateEventExpression ( options , ctx , prop ) ;
0 commit comments