You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have code like this: const { foo, bar = foo } = defineProps<{ foo: string, bar?: string }>()
What is expected?
No error.
What is actually happening?
Error foo is not defined
System Info
n/a
Any additional comments?
const { a, b = a } = { a: 1, b: undefined } is valid syntax in regular js and as such should be supported in vue also.
The text was updated successfully, but these errors were encountered:
minht11
changed the title
Cannot use one from to set other prop default value with props destructuring
Cannot use prop as default value for other prop with props destructuring
Nov 13, 2024
minht11
changed the title
Cannot use prop as default value for other prop with props destructuring
Cannot use prop as default value for other prop with props destructuring const { foo, bar = foo }
Nov 13, 2024
Vue version
3.5.12
Link to minimal reproduction
https://play.vuejs.org/#__PROD__eNp9UsFOwzAM/RUrF0CaOsHgUrohQEOCA0zAMRIqrVsy2iRK0jKp6r/jZOvY0LRTbL/n5NkvHbvVOmobZDFLHNa6Sh3OuARIHpSCuFBqytlJesIZjKmejHdIlNrMCO3Aoms0VUStlXHgWwujauAsGlPiH+Ds2revG4jKRszZTMlClNHSKkkCOv8uZ5mqtajQvGgnlLScxRAQj6VVpX6eQs2ZBkdDPfvC7PtAfWlXvsbZwqBF05KMLeZSU6Jbw/O3Z1xRvAVrlTcVsY+Ar2hV1XiNa9pdI3OSvcMLah/DToQs3+185VDaYSgv1DP7wOeMlnR/ZPQ/uZPoMvRx2dMWN/v1Bm7cqFJZkmuO+rfO0Katgw7I0BF8pgamPoSezhwLIXFhlLZJIMRgnSHBgXgzZNDPTs/2LKRk/8vkog3BJgxXdR0dfZ+M/4F09QFwiPb+GQ350aLxi6MpJ9FVdH7B+l9N7+ZX
Steps to reproduce
Have code like this:
const { foo, bar = foo } = defineProps<{ foo: string, bar?: string }>()
What is expected?
No error.
What is actually happening?
Error foo is not defined
System Info
Any additional comments?
const { a, b = a } = { a: 1, b: undefined }
is valid syntax in regular js and as such should be supported in vue also.The text was updated successfully, but these errors were encountered: