pageClass | sidebarDepth | title | description |
---|---|---|---|
rule-details |
0 |
vue/prefer-type-emits-decl |
enforce type-based `defineEmits` |
enforce type-based
defineEmits
- ❗ This rule has not been released yet.
This rule forces developers to use the type-based declaration of defineEmits
instead of runtime declaration.
This rule only works in setup script and lang="ts"
.
<script setup lang="ts">
/* ✓ GOOD */
const emit = defineEmits<{
(e: 'change', id: number): void
(e: 'update', value: string): void
}>()
</script>
<script setup lang="ts">
/* ✗ BAD */
const emit = defineEmits(['change', 'update'])
</script>
Nothing.