Subscribe on changes!

<script setup> Component throws an error if the first expression after defineProps starts with parenthesis

avatar
Aug 8th 2022

Vue version

3.2.37

Link to minimal reproduction

https://sfc.vuejs.org/#eNp9j7FuwzAMRH9F0JQCsdTZVQz0Dzp01OLaTKogogiSdgfD/16p7RC0QBeCd0c8HDf7TOTWBWxvg0Km26gwRDQmzGkdXkE0+LZFDP4ur1ImTqTmNuLlFK1KtEZAF6rpVFDUEBcSczIznBPCS1OHbX94inh4bDP4b8RgjzZlKqxdHsldpWBts7US8Seo8N58Oc2rdZuO9l2VpPdezlP74Squ8MXXzfGCmjI4kNy9cfkQ4AqO9njH8NVcgTsGnIGB/2P+Ov3Dbdg94m73T5s5deA=

Steps to reproduce

The repro link demonstrates the issue with no action required

What is expected?

The component renders

What is actually happening?

An error is thrown: '__props is not a function'

System Info

No response

Any additional comments?

Close-enough example to how it was discovered. If the first line after defineProps uses a cast wrapped in parentheses to make a TS error go away, it will cause this error: https://sfc.vuejs.org/#eNpNTzFuwzAM/AqhJQnQSLurGOgPCrSjFtWWXQURJYh0jCLw30slGTKRxyOPdzf1UYq+LkF1ynJI5eI59A4B7Biv/XcgtqZ1Dq154QXSUGNhuHicT04xOQUUeCnCDhmJodRcCE4whili+Gxof2vSU84dfHGNODvcDu8O92vEMa/gCTz+HbRsyOFOyk5Yax6/evWmYiq58jH5os+UUWzfJd2TEBcd3CdtJrkaduqXuVBnDE1DC3smnetspNN1QY4p6EDp+FPzSqGKsFNNYhN3avsHxFtk2w==

Naively, it looks like the generated source is just missing a semicolon after __props.

const props = __props

(0);