Subscribe on changes!

literal constant references should be supported in macros

avatar
Apr 19th 2022

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