Skip to content

fix(language-core): intersect __VLS_slots with __VLS_ctx.$slots #5083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Feb 12, 2025
Prev Previous commit
Next Next commit
Update index.ts
  • Loading branch information
KazariEX committed Jan 7, 2025
commit c33836cacb39ff9a3e8d0321266c89f8a340eca2
4 changes: 2 additions & 2 deletions packages/language-core/lib/codegen/template/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function* generateSlots(
): Generator<Code> {
const name = getSlotsPropertyName(options.vueCompilerOptions.target);
if (!options.hasDefineSlots) {
yield `var __VLS_slots!: `;
yield `var __VLS_slots!: __VLS_OmitStringIndex<typeof __VLS_ctx.${name}> & `;
for (const { expVar, propsVar } of ctx.dynamicSlots) {
ctx.hasSlot = true;
yield `Partial<Record<NonNullable<typeof ${expVar}>, (props: typeof ${propsVar}) => any>> &${newLine}`;
Expand Down Expand Up @@ -99,7 +99,7 @@ function* generateSlots(
}
yield `}${endOfLine}`;
}
return `__VLS_OmitStringIndex<typeof __VLS_ctx.${name}> & typeof ${options.slotsAssignName ?? `__VLS_slots`}`;
return `typeof ${options.slotsAssignName ?? `__VLS_slots`}`;
}

function* generateInheritedAttrs(
Expand Down
Loading