Unexpected token, expected "," when using defineProps with computed (escaped) object key #184
Closed
8 of 9 tasks
Labels
bug: upstream
Bug in a dependency of this repository
p3-minor-bug 🔨
An edge case that only affects very specific usage (priority)
Related plugins
plugin-vue
plugin-vue-jsx
Describe the bug
Hi everyone. The following code in a Vue SFC raises a parsing error:
I'm opening this issue here because I've tested this behavior in the Vue SFC Playground without problems, hence I think the error occurs on the vite side. It seems that, at some point,
vite-plugin-vue
can't parse interfaces (or type aliases) containing computed (or escaped) object properties.The error can be fixed by commenting the
'onUpdate:modelValue'
prop or changing it to not be computed anymore (eg.onUpdateModelValue
.I've encountered this issue by using the new defineProps() to wrap a third party component (Quasar's QTable by extending its props (
QTableProps
), which contains some computed property names likeonUpdate:pagination
,onUpdate:selected
and such.I've reviewed Vue 3.3's announcement blog post and vuejs/core#8083 but I believe this case should not fall in the "complex types" category. Maybe this quote by Evan is the key to understand the problem:
Additional info: i'm encountering this error with both
vite 2.9.15
(locally) andvite 4.3.9
(on stackblitz).Reproduction
https://stackblitz.com/edit/vitejs-vite-sqq4aq?file=package.json,src%2Fcomponents%2FHelloWorld.vue&terminal=dev
Steps to reproduce
pnpm install && pnpm run dev
System Info
Used Package Manager
pnpm
Logs
Click to expand!
Validations
The text was updated successfully, but these errors were encountered: