Skip to content

Commit

Permalink
fix: slot props missing report missing
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed May 1, 2023
1 parent 529415e commit e34f42e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions packages/vue-language-core/src/generators/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,9 @@ export function generate(
['', 'template', node.loc.end.offset, capabilitiesPresets.diagnosticOnly],
']',
['', 'template', node.loc.end.offset, capabilitiesPresets.diagnosticOnly],
'?.({\n',
'?.(',
['', 'template', startTagOffset, capabilitiesPresets.diagnosticOnly],
'{\n',
);
}
else {
Expand Down Expand Up @@ -1587,7 +1589,11 @@ export function generate(
);
}
}
codes.push(hasScriptSetupSlots ? `});\n` : `};\n`);
codes.push(
'}',
hasScriptSetupSlots ? ['', 'template', startTagOffset + node.tag.length, capabilitiesPresets.diagnosticOnly] : '',
hasScriptSetupSlots ? `);\n` : `;\n`
);

if (hasScriptSetupSlots) {
return;
Expand Down
4 changes: 2 additions & 2 deletions packages/vue-test-workspace/vue-tsc/#2726/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ const foo = ref('bar');
defineSlots<{
default: {
foo: string;
buz: number;
buz?: number;
};
}>();
</script>

<template>
<slot v-bind="{ foo }" />
<slot v-bind="{ foo: foo }" />
</template>

0 comments on commit e34f42e

Please sign in to comment.