Skip to content

Commit d94bd3c

Browse files
committed
fix(language-core): improve fallthrough attributes and defineEmit compatibility
1 parent 21205fb commit d94bd3c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,11 @@ export function* generatePropsOption(
141141
const { arg } = scriptSetupRanges.props.define;
142142
optionExpCodes.push(generateSfcBlockSection(scriptSetup, arg.start, arg.end, codeFeatures.navigation));
143143
}
144-
if (inheritAttrs && options.templateCodegen?.inheritedAttrVars.size && !hasEmitsOption) {
145-
const attrsType = `ReturnType<typeof __VLS_template>['attrs']`;
144+
if (inheritAttrs && options.templateCodegen?.inheritedAttrVars.size) {
145+
let attrsType = `ReturnType<typeof __VLS_template>['attrs']`;
146+
if (hasEmitsOption) {
147+
attrsType = `Omit<${attrsType}, \`on\${string}\`>`;
148+
}
146149
const propsType = `__VLS_PickNotAny<${ctx.helperTypes.OmitIndexSignature.name}<${attrsType}>, {}>`;
147150
const optionType = `${ctx.helperTypes.TypePropsToOption.name}<${propsType}>`;
148151
if (optionExpCodes.length) {

0 commit comments

Comments
 (0)