Open Wakotu opened 2 years ago
This is correct syntax. In Vue 3 you can define emits with the defineEmits
compiler macro. E.g.:
<script setup lang="ts">
const emit = defineEmits<{ (event: 'eventName', id: string): void }>()
</script>
<template>
<button @click="emit('eventName', 'abc')" />
</template>
You can find more information here: https://vuejs.org/guide/typescript/composition-api.html#typing-component-emits
I would keep it this way, as $emit
would probably only be used with the options API that is not the recommended default anymore with Vue 3.
The original snippet was:
I guess you are trying to type
$emit
but the$
was recognized as a symbol for placeholder. You can use\\$
in the snippet body instead.