Skip to content

Commit 8476cd8

Browse files
so1vejohnsoncodehk
andauthored
fix: access to slots directly (#3671)
Co-authored-by: Johnson Chu <[email protected]>
1 parent 2a44b10 commit 8476cd8

File tree

2 files changed

+11
-0
lines changed
  • packages
    • vue-language-core/src/generators
    • vue-test-workspace/vue-tsc/non-strict-template/#3671

2 files changed

+11
-0
lines changed

packages/vue-language-core/src/generators/template.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ export function generate(
9999
let expectedErrorStart: undefined | number;
100100
let expectedErrorNode: CompilerDOM.CommentNode | undefined;
101101

102+
if (slotsAssignName) {
103+
localVars.set(slotsAssignName, 1);
104+
}
105+
102106
if (propsAssignName) {
103107
localVars.set(propsAssignName, 1);
104108
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<template>
2+
{{ slots.footer }}
3+
</template>
4+
5+
<script lang="ts" setup generic="T extends string">
6+
const slots = defineSlots<Record<T, () => any> & { footer(props: { id: number }): any}>();
7+
</script>

0 commit comments

Comments
 (0)