Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 1.38 KB

prefer-type-emits-decl.md

File metadata and controls

56 lines (39 loc) · 1.38 KB
pageClass sidebarDepth title description
rule-details
0
vue/prefer-type-emits-decl
enforce type-based `defineEmits`

vue/prefer-type-emits-decl

enforce type-based defineEmits

  • This rule has not been released yet.

📖 Rule Details

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>

🔧 Options

Nothing.

👫 Related Rules

🔍 Implementation