diff --git a/packages/compiler-sfc/__tests__/compileScript/__snapshots__/defineProps.spec.ts.snap b/packages/compiler-sfc/__tests__/compileScript/__snapshots__/defineProps.spec.ts.snap
index d59807b8547..b6f977fbe8d 100644
--- a/packages/compiler-sfc/__tests__/compileScript/__snapshots__/defineProps.spec.ts.snap
+++ b/packages/compiler-sfc/__tests__/compileScript/__snapshots__/defineProps.spec.ts.snap
@@ -233,6 +233,33 @@ export default /*@__PURE__*/_defineComponent({
+return { }
+}
+
+})"
+`;
+
+exports[`defineProps > w/ extends intersection type 1`] = `
+"import { defineComponent as _defineComponent } from 'vue'
+type Foo = {
+ x?: number;
+ };
+ interface Props extends Foo {
+ z: number
+ y: string
+ }
+
+export default /*#__PURE__*/_defineComponent({
+ props: {
+ z: { type: Number, required: true },
+ y: { type: String, required: true },
+ x: { type: Number, required: false }
+ },
+ setup(__props: any, { expose: __expose }) {
+ __expose();
+
+
+
return { }
}
@@ -268,6 +295,31 @@ export default /*@__PURE__*/_defineComponent({
+return { }
+}
+
+})"
+`;
+
+exports[`defineProps > w/ intersection type 1`] = `
+"import { defineComponent as _defineComponent } from 'vue'
+type Foo = {
+ x?: number;
+ };
+ type Bar = {
+ y: string;
+ };
+
+export default /*#__PURE__*/_defineComponent({
+ props: {
+ x: { type: Number, required: false },
+ y: { type: String, required: true }
+ },
+ setup(__props: any, { expose: __expose }) {
+ __expose();
+
+
+
return { }
}
diff --git a/packages/compiler-sfc/__tests__/compileScript/defineProps.spec.ts b/packages/compiler-sfc/__tests__/compileScript/defineProps.spec.ts
index c9ef103c416..836badb51c8 100644
--- a/packages/compiler-sfc/__tests__/compileScript/defineProps.spec.ts
+++ b/packages/compiler-sfc/__tests__/compileScript/defineProps.spec.ts
@@ -261,6 +261,51 @@ const props = defineProps({ foo: String })
})
})
+ test('w/ extends intersection type', () => {
+ const { content, bindings } = compile(`
+
+ `)
+ assertCode(content)
+ expect(content).toMatch(`z: { type: Number, required: true }`)
+ expect(content).toMatch(`y: { type: String, required: true }`)
+ expect(content).toMatch(`x: { type: Number, required: false }`)
+ expect(bindings).toStrictEqual({
+ x: BindingTypes.PROPS,
+ y: BindingTypes.PROPS,
+ z: BindingTypes.PROPS,
+ })
+ })
+
+ test('w/ intersection type', () => {
+ const { content, bindings } = compile(`
+
+ `)
+ assertCode(content)
+ expect(content).toMatch(`y: { type: String, required: true }`)
+ expect(content).toMatch(`x: { type: Number, required: false }`)
+ expect(bindings).toStrictEqual({
+ x: BindingTypes.PROPS,
+ y: BindingTypes.PROPS,
+ })
+ })
+
test('w/ exported interface', () => {
const { content, bindings } = compile(`