Skip to content

Commit

Permalink
fix: (__VLS_ctx).xxx -> __VLS_ctx.xxx
Browse files Browse the repository at this point in the history
close #2225,
  • Loading branch information
johnsoncodehk committed Dec 20, 2022
1 parent 70891a6 commit 75a088b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
Expand Up @@ -608,7 +608,6 @@ export function generate(
const useGlobalThisTypeInCtx = fileName.endsWith('.html');

codeGen.push(`let __VLS_ctx!: ${useGlobalThisTypeInCtx ? 'typeof globalThis &' : ''}`);
codeGen.push(`import('./__VLS_types.js').PickNotAny<__VLS_Ctx, {}> & `);
if (sfc.scriptSetup) {
codeGen.push(`InstanceType<import('./__VLS_types.js').PickNotAny<typeof __VLS_publicComponent, new () => {}>> & `);
}
Expand Down
Expand Up @@ -1373,7 +1373,7 @@ export function generate(
prop.loc.start.offset,
capabilitiesSet.diagnosticOnly,
]);
codeGen.push(`(await import('./__VLS_types.js')).directiveFunction((__VLS_ctx).`);
codeGen.push(`(await import('./__VLS_types.js')).directiveFunction(__VLS_ctx.`);
codeGen.push([
camelize('v-' + prop.name),
'template',
Expand Down
4 changes: 2 additions & 2 deletions vue-language-tools/vue-language-core/src/utils/transform.ts
Expand Up @@ -75,7 +75,7 @@ export function walkInterpolationFragment(
}
}
else {
cb('(__VLS_ctx).', undefined);
cb('__VLS_ctx.', undefined);
if (ctxVars[i + 1].isShorthand) {
cb(code.substring(ctxVars[i].offset, ctxVars[i + 1].offset + ctxVars[i + 1].text.length), ctxVars[i].offset);
cb(': ', undefined);
Expand All @@ -100,7 +100,7 @@ export function walkInterpolationFragment(
}
else {
cb('', ctxVars[ctxVars.length - 1].offset, true);
cb('(__VLS_ctx).', undefined);
cb('__VLS_ctx.', undefined);
cb(code.substring(ctxVars[ctxVars.length - 1].offset), ctxVars[ctxVars.length - 1].offset);
}
}
Expand Down
31 changes: 31 additions & 0 deletions vue-language-tools/vue-test-workspace/vue-tsc/#2225/main.vue
@@ -0,0 +1,31 @@
<script setup lang="ts">
const resetFunction = () => {
console.log('reset')
}
const resetFunction2 = () => {
console.log('reset2')
}
const searchFunction = () => {
console.log('search')
}
const searchFunction2 = () => {
console.log('search2')
}
</script>

<template>
<TestComp
@reset="
() => {
resetFunction()
resetFunction2()
}
"
@search="
() => {
searchFunction()
searchFunction2()
}
"
/>
</template>

0 comments on commit 75a088b

Please sign in to comment.