Is there a way to enter emissions in the vue 3 Options API similar to the Composition API? According to the combination (documentation):
<script setup lang="ts"> // type-based const emit = defineEmits<{ (e: 'change', id: number): void (e: 'update', value: string): void }>() </script>
But for the options API we only have payload validation (documentation):
emits: { addBook(payload: { bookName: string }) { // perform runtime validation return payload.bookName.length > 0 } }
So if we don't need validation, eslint will treat the parameter as unused:
emits: { change: (id: number) => true // 'id' is defined but never used }
Add ignore comment to suppress warning:
Or perform simple verification on
id
: