Skip to content

Commit

Permalink
fix(language-core): fallthrough attributes should be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Aug 26, 2024
1 parent 29b13cf commit b2707f0
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/language-core/lib/codegen/script/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function* generateTemplateContext(
yield `return {${newLine}`;
yield `slots: ${options.scriptSetupRanges?.slots.name ?? '__VLS_slots'},${newLine}`;
yield `refs: __VLS_refs as __VLS_PickRefsExpose<typeof __VLS_refs>,${newLine}`;
yield `attrs: __VLS_inheritedAttrs,${newLine}`;
yield `attrs: {} as Partial<typeof __VLS_inheritedAttrs>,${newLine}`;
yield `}${endOfLine}`;
}

Expand Down
14 changes: 7 additions & 7 deletions packages/tsc/tests/__snapshots__/dts.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,17 @@ type __VLS_Prettify<T> = {
`;
exports[`vue-tsc-dts > Input: generic/main.vue, Output: generic/main.vue.d.ts 1`] = `
"declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_OmitIndexSignature<{
"declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_OmitIndexSignature<Partial<{
"onUpdate:title"?: (title: string) => any;
onBar?: (data: number) => any;
title?: string;
foo: number;
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_OmitIndexSignature<{
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps>>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_OmitIndexSignature<Partial<{
"onUpdate:title"?: (title: string) => any;
onBar?: (data: number) => any;
title?: string;
foo: number;
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps>>>>, {}, {}>;
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps>>>>>, {}, {}>;
export default _default;
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
type __VLS_TypePropsToOption<T> = {
Expand Down Expand Up @@ -671,7 +671,7 @@ exports[`vue-tsc-dts > Input: template-slots/component.vue, Output: template-slo
}): any;
};
refs: __VLS_PickRefsExpose<{}>;
attrs: {};
attrs: Partial<{}>;
};
type __VLS_Slots = ReturnType<typeof __VLS_template>['slots'];
declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
Expand Down Expand Up @@ -714,7 +714,7 @@ declare const __VLS_template: () => {
'no-bind': () => VNode[];
};
refs: __VLS_PickRefsExpose<{}>;
attrs: {};
attrs: Partial<{}>;
};
type __VLS_Slots = ReturnType<typeof __VLS_template>['slots'];
declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
Expand All @@ -740,7 +740,7 @@ exports[`vue-tsc-dts > Input: template-slots/component-destructuring.vue, Output
}) => any[];
};
refs: __VLS_PickRefsExpose<{}>;
attrs: {};
attrs: Partial<{}>;
};
type __VLS_Slots = ReturnType<typeof __VLS_template>['slots'];
declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
Expand Down Expand Up @@ -770,7 +770,7 @@ exports[`vue-tsc-dts > Input: template-slots/component-no-script.vue, Output: te
}): any;
};
refs: __VLS_PickRefsExpose<{}>;
attrs: {};
attrs: Partial<{}>;
};
type __VLS_Slots = ReturnType<typeof __VLS_template>['slots'];
declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup lang="ts">
<script setup lang="ts">
import { exactType } from '../../shared';
import basic from './basic.vue';
import inheritAttrsFalse from './inherit-attrs-false.vue';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script setup lang="ts">
import child from './child.vue';
</script>

<template>
<child bar="bar" />
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script setup lang="ts">
defineProps<{
bar: string;
}>();
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script setup lang="ts">
import basic from './basic.vue';
</script>

<template>
<basic />
</template>

0 comments on commit b2707f0

Please sign in to comment.