fix(compiler-sfc): add type for props's properties in prod mode (#4790)
fix #4783
This commit is contained in:
@@ -82,7 +82,9 @@ export default /*#__PURE__*/_defineComponent({
|
||||
props: {
|
||||
foo: { default: 1 },
|
||||
bar: { default: () => {} },
|
||||
baz: null
|
||||
baz: null,
|
||||
boola: { type: Boolean },
|
||||
boolb: { type: [Boolean, Number] }
|
||||
},
|
||||
setup(__props: any) {
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ describe('sfc props transform', () => {
|
||||
const { content } = compile(
|
||||
`
|
||||
<script setup lang="ts">
|
||||
const { foo = 1, bar = {} } = defineProps<{ foo?: number, bar?: object, baz?: any }>()
|
||||
const { foo = 1, bar = {} } = defineProps<{ foo?: number, bar?: object, baz?: any, boola?: boolean, boolb?: boolean | number }>()
|
||||
</script>
|
||||
`,
|
||||
{ isProd: true }
|
||||
@@ -93,7 +93,9 @@ describe('sfc props transform', () => {
|
||||
expect(content).toMatch(`props: {
|
||||
foo: { default: 1 },
|
||||
bar: { default: () => {} },
|
||||
baz: null
|
||||
baz: null,
|
||||
boola: { type: Boolean },
|
||||
boolb: { type: [Boolean, Number] }
|
||||
}`)
|
||||
assertCode(content)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user