vuejs/core

literal constant references should be supported in macros

Closed this issue · 1 comments

sxzz commented

What problem does this feature solve?

Consider the following code

<script setup>
const UPDATE_KEY = "foo"
defineEmits([UPDATE_KEY])
</script>

UPDATE_KEY will never be changed and uses no lifecycle hooks.
It can be hoisted, then defineProps and defineEmits can reference this variable.

What does the proposed API look like?

No API involved