Defining an array as props for a Vue 3 component using the Composition API is simple...
<script setup>
defineProps({
items: {
type: Array,
required: true,
},
});
</script>
Now this array should be an array of objects like the following. That's not a problem either.
[
{
username: "foo",
email: "[email protected]"
},
{
username: "bar",
email: "[email protected]"
}
]
But is there a way to define that each object in the array must contain the properties username and email? So that someone using this component's props knows what the objects must look like?