When working with TypeScript in Vue components, I have come across the following way to initialize props:
@Prop({ type: Object }) tabDetails: tabDetailsTypes
The structure of the tabDetailsTypes looks like this:
export interface tabDetailsTypes {
label: string
name: string
count: number | string
}
I would like to achieve the same thing in a Vue component using JavaScript syntax like this:
props: {
serverUrls: {
required: true,
type: Object,
default: () => ({
label: '',
name: '',
count: 1
})
}
}
Is this the correct syntax or is there another way to achieve this?