diff --git a/packages/language-core/lib/codegen/script/scriptSetup.ts b/packages/language-core/lib/codegen/script/scriptSetup.ts index 0e46c94992..1a56775093 100644 --- a/packages/language-core/lib/codegen/script/scriptSetup.ts +++ b/packages/language-core/lib/codegen/script/scriptSetup.ts @@ -163,15 +163,14 @@ function* generateSetupFunction( } } if (scriptSetupRanges.slots.define) { - if (!scriptSetupRanges.slots.name) { - setupCodeModifies.push([[`const __VLS_slots = `], scriptSetupRanges.slots.define.start, scriptSetupRanges.slots.define.start]); - } - else if (scriptSetupRanges.slots.isObjectBindingPattern) { + if (scriptSetupRanges.slots.isObjectBindingPattern) { setupCodeModifies.push([ [`__VLS_slots;\nconst __VLS_slots = `], scriptSetupRanges.slots.define.start, scriptSetupRanges.slots.define.start, ]); + } else if (!scriptSetupRanges.slots.name) { + setupCodeModifies.push([[`const __VLS_slots = `], scriptSetupRanges.slots.define.start, scriptSetupRanges.slots.define.start]); } } if (scriptSetupRanges.emits.define && !scriptSetupRanges.emits.name) { diff --git a/test-workspace/tsc/vue3/#4326/main.vue b/test-workspace/tsc/vue3/#4326/main.vue new file mode 100644 index 0000000000..9a921fc2b0 --- /dev/null +++ b/test-workspace/tsc/vue3/#4326/main.vue @@ -0,0 +1,11 @@ +