@@ -58,7 +58,7 @@ export function* generateElementEvents(
58
58
const emitName = emitPrefix + source ;
59
59
const camelizedEmitName = camelize ( emitName ) ;
60
60
61
- yield `() : __VLS_NormalizeComponentEvent<typeof ${ propsVar } , typeof ${ emitsVar } , '${ propName } ', '${ emitName } ', '${ camelizedEmitName } '> => (${ newLine } ` ;
61
+ yield `const ${ ctx . getInternalVariable ( ) } : __VLS_NormalizeComponentEvent<typeof ${ propsVar } , typeof ${ emitsVar } , '${ propName } ', '${ emitName } ', '${ camelizedEmitName } '> = (${ newLine } ` ;
62
62
if ( prop . name === 'on' ) {
63
63
yield `{ ` ;
64
64
yield * generateEventArg ( ctx , source , start ! , emitPrefix . slice ( 0 , - 1 ) , ctx . codeFeatures . navigation ) ;
@@ -121,10 +121,12 @@ export function* generateEventExpression(
121
121
let isFirstMapping = true ;
122
122
123
123
const ast = createTsAst ( options . ts , prop . exp , prop . exp . content ) ;
124
- const _isCompoundExpression = isCompoundExpression ( options . ts , ast ) ;
125
- if ( _isCompoundExpression ) {
126
- yield `(...[$event]) => { ${ newLine } ` ;
124
+ const isCompound = isCompoundExpression ( options . ts , ast ) ;
125
+
126
+ if ( isCompound ) {
127
127
ctx . addLocalVariable ( '$event' ) ;
128
+
129
+ yield `(...[$event]) => {${ newLine } ` ;
128
130
yield * ctx . generateConditionGuards ( ) ;
129
131
prefix = `` ;
130
132
suffix = `` ;
@@ -135,7 +137,7 @@ export function* generateEventExpression(
135
137
ctx ,
136
138
'template' ,
137
139
offset => {
138
- if ( _isCompoundExpression && isFirstMapping ) {
140
+ if ( isCompound && isFirstMapping ) {
139
141
isFirstMapping = false ;
140
142
ctx . inlayHints . push ( {
141
143
blockName : 'template' ,
@@ -159,7 +161,7 @@ export function* generateEventExpression(
159
161
suffix
160
162
) ;
161
163
162
- if ( _isCompoundExpression ) {
164
+ if ( isCompound ) {
163
165
ctx . removeLocalVariable ( '$event' ) ;
164
166
165
167
yield endOfLine ;
0 commit comments