Skip to content

Commit d45228a

Browse files
authored
fix(language-core): omit defined emit props only (#5705)
1 parent 426f8d5 commit d45228a

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

packages/language-core/lib/codegen/script/component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function* generatePropsOption(
125125
if (options.templateCodegen?.inheritedAttrVars.size) {
126126
let attrsType = `__VLS_InheritedAttrs`;
127127
if (hasEmitsOption) {
128-
attrsType = `Omit<${attrsType}, \`on\${string}\`>`;
128+
attrsType = `Omit<${attrsType}, keyof __VLS_EmitProps>`;
129129
}
130130
getOptionCodes.push(() => {
131131
const propsType = `__VLS_PickNotAny<${ctx.localTypes.OmitIndexSignature}<${attrsType}>, {}>`;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script setup lang="ts">
2+
defineEmits<{ test: [] }>();
3+
</script>
4+
5+
<template>
6+
<input />
7+
</template>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<script setup lang="ts">
2+
import child from './child.vue';
3+
import { exactType } from '../../shared';
4+
</script>
5+
6+
<template>
7+
<child @input="exactType($event, {} as Event)" />
8+
</template>

0 commit comments

Comments
 (0)