defineProps is not compiled in a nested scope in SFC script setup
Version
3.2.6
Reproduction link
Steps to reproduce
Call defineProps in a script setup SFC file in a scope that is not at the top level.
What is expected?
defineProps should be compiled to __props
What is actually happening?
defineProps is called at runtime causing a ReferenceError
Implementation like the repo example is useful when defining a component with generic props
defineEmits()
is a macro, it needs to be able to statically analyze what is passed to it in order to know what to generate, so it doesn't seem reasonable to be used that way as it doesn't get called in reality, even less with a generic T
that is never given any type.
Maybe you are looking for this: https://github.com/vuejs/vue-next/pull/3682