DefineEmits and DefineProps compiler macros with default values in TypeScript
This is how we:
a. use the defineEmits() and defineProps() compiler macros with Composition API's Script Setup and TypeScript
b. pass default values to our component's props
<script setup>
const props = withDefaults(
defineProps<{
message: string,
isActive: boolean
}>(),
{
message: 'Default message',
isActive: false
}
);
const emit = defineEmits<{
(e: "customEventName", payload?: object) : void
}>();
</script>