Subscribe on changes!

[FR] Function style declaration of `defineEmits`

avatar
Jun 17th 2023

What problem does this feature solve?

Now that tuple style declaration is supported, can we also add function style declaration? It's closer to how we write defineProps<T>(), and unlike tuple labels, the arguments have to be named, therefore more constraints.

What does the proposed API look like?

const emit = defineEmits<{
  update(val: string): void
}>()
avatar
Jun 23rd 2023

This has been discussed in the RFC repo: https://github.com/vuejs/rfcs/discussions/500