File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
packages/language-core/lib/codegen/template Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ export function* generateElementEvents(
34
34
yield `let ${ propsVar } !: __VLS_FunctionalComponentProps<typeof ${ componentVar } , typeof ${ componentInstanceVar } >${ endOfLine } ` ;
35
35
}
36
36
const originalPropName = camelize ( 'on-' + prop . arg . loc . source ) ;
37
+ const originalPropNameObjectKey = variableNameRegex . test ( originalPropName )
38
+ ? originalPropName
39
+ : `'${ originalPropName } '` ;
37
40
yield `const ${ ctx . getInternalVariable ( ) } : ` ;
38
41
if ( ! options . vueCompilerOptions . strictTemplates ) {
39
42
yield `Record<string, unknown> & ` ;
@@ -44,13 +47,13 @@ export function* generateElementEvents(
44
47
yield `: __VLS_IsAny<typeof ${ eventsVar } ['${ prop . arg . loc . source } ']> extends false${ newLine } ` ;
45
48
yield `? {${ newLine } ` ;
46
49
yield `/**__VLS_emit,${ emitVar } ,${ prop . arg . loc . source } */${ newLine } ` ;
47
- yield `' ${ originalPropName } ' : typeof ${ eventsVar } ['${ prop . arg . loc . source } ']${ newLine } ` ;
50
+ yield `${ originalPropNameObjectKey } : typeof ${ eventsVar } ['${ prop . arg . loc . source } ']${ newLine } ` ;
48
51
yield `}${ newLine } ` ;
49
52
if ( prop . arg . loc . source !== camelize ( prop . arg . loc . source ) ) {
50
53
yield `: __VLS_IsAny<typeof ${ eventsVar } ['${ camelize ( prop . arg . loc . source ) } ']> extends false${ newLine } ` ;
51
54
yield `? {${ newLine } ` ;
52
55
yield `/**__VLS_emit,${ emitVar } ,${ camelize ( prop . arg . loc . source ) } */${ newLine } ` ;
53
- yield `' ${ originalPropName } ' : typeof ${ eventsVar } ['${ camelize ( prop . arg . loc . source ) } ']${ newLine } ` ;
56
+ yield `${ originalPropNameObjectKey } : typeof ${ eventsVar } ['${ camelize ( prop . arg . loc . source ) } ']${ newLine } ` ;
54
57
yield `}${ newLine } ` ;
55
58
}
56
59
yield `: typeof ${ propsVar } ${ newLine } ` ;
You can’t perform that action at this time.
0 commit comments