Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dha-corey opened this issue Aug 8, 2022 · 0 comments · Fixed by #6461

Comments

@dha-corey
Copy link

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);
chrislone pushed a commit to chrislone/core that referenced this issue Feb 4, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
zhangzhonghe pushed a commit to zhangzhonghe/core that referenced this issue Apr 12, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@github-actions github-actions bot locked and limited conversation to collaborators Sep 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants