Skip to content

Commit a6fd347

Browse files
committed
chore: update test
1 parent d6d16a5 commit a6fd347

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

packages/compiler-sfc/__tests__/compileScript/__snapshots__/defineProps.spec.ts.snap

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,27 @@ export default /*@__PURE__*/_defineComponent({
148148
149149
150150
151+
return { }
152+
}
153+
154+
})"
155+
`;
156+
157+
exports[`defineProps > w/ TSTypeAliasDeclaration 1`] = `
158+
"import { defineComponent as _defineComponent } from 'vue'
159+
type FunFoo<O> = (item: O) => boolean;
160+
type FunBar = FunFoo<number>;
161+
162+
export default /*@__PURE__*/_defineComponent({
163+
props: {
164+
foo: { type: Function, required: false, default: () => true },
165+
bar: { type: Function, required: false, default: () => true }
166+
},
167+
setup(__props: any, { expose: __expose }) {
168+
__expose();
169+
170+
171+
151172
return { }
152173
}
153174

packages/compiler-sfc/__tests__/compileScript/defineProps.spec.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,4 +808,30 @@ const props = defineProps({ foo: String })
808808
expect(content).toMatch(`foo: { default: 5.5, type: Number }`)
809809
assertCode(content)
810810
})
811+
812+
test('w/ TSTypeAliasDeclaration', () => {
813+
const { content } = compile(`
814+
<script setup lang="ts">
815+
type FunFoo<O> = (item: O) => boolean;
816+
type FunBar = FunFoo<number>;
817+
withDefaults(
818+
defineProps<{
819+
foo?: FunFoo<number>;
820+
bar?: FunBar;
821+
}>(),
822+
{
823+
foo: () => true,
824+
bar: () => true,
825+
},
826+
);
827+
</script>
828+
`)
829+
assertCode(content)
830+
expect(content).toMatch(
831+
`foo: { type: Function, required: false, default: () => true }`,
832+
)
833+
expect(content).toMatch(
834+
`bar: { type: Function, required: false, default: () => true }`,
835+
)
836+
})
811837
})

0 commit comments

Comments
 (0)