Subscribe on changes!

Enum breaks defineEmit with Type-based declaration

avatar
Aug 24th 2023

Vue version

Vue@3.3.4

Link to minimal reproduction

https://play.vuejs.org/#eNqNU8Fu2zAM/RXBlyRAYx26U+oGWYIcug3psGY7CRhcm0nVWpIh0WmAwP8+SnYcJ0uH+WSSj3zko3iIPpdlvKsgmkSJy6wskTnAqpwKLVVpLLJ5hWg021ij2CDmjelTBndCC72pdIaSAC+pzgtYFDJ7G47YQWjGMqOdKSAuzHY46MWZqdDJHAYjKlELnfCGmkjJQFBlkSKQxVjS0s8yn3gvol4ZEXHCJLxLiG6ipumxSsv41RlNY4VORBtwIpo0vXkfDeFtKopYugnnWa4pLYdC7mysAbkuFZ8RjNtKo1Qwzo2a3ca38SeeS4d9dwxOjZ+teXdgqYiIbno0nJw7sGMLOgcL9n9pL9L61Behv+g9O2lbkyjoaBMbub2QJDOqlAXYx9Iv8FyatCjM+5fgQ1tBN0v2AtnbFf+r2zczfbcQOuvNj6ndAjbh5dMK9vTfBZXJq6JdwwfBH0CvqPI9NrB55Z8AadjhQrcPYcNSb9duuUfQ7jiUbzSoEfBhH4t/jH5ql9TuqXh6+ZfHwopUb+lt+uc1FbY7ncP853r9uPq9/LVcrZ/q5oZEFPPnppS/D0y1T/NZnj64GCiJ7J7lsJEalmS45HBE+G8IO9A4YWf148W3h8XX0YTtjMyP6Ho6HPn/o339XJsckqDH4XsYXiO462r7n9Pttiy9+21xSTPuBzfcwfy3BoddWitTAJxf+aV+MTraCeyD6qArda7MabAwASk7CK0MvLuO6j86DK76

Steps to reproduce

Run this code. Try with passing BUTTON_EVENTS.CLICK enum value inside defineEmits and simple string value 'click'. See console.

What is expected?

The click event handler inside App.vue should run a single time.

What is actually happening?

The click event handler inside App.vue runs twice.

System Info

No response

Any additional comments?

I guess it is something has to do with enums because behavior differs with or without them. Also, it works the same when we use Runtime declaration of defineEmits like that: const emit = defineEmits([BUTTON_EVENTS.CLICK]) works the same as const emit = defineEmits(['click'])

avatar
Aug 24th 2023

I faced the same issue with enums iniside defineEmits

avatar
Aug 24th 2023

Duplicate of #8466