Ref sugar compile result incorrect with destructuring + arrow function expression
Version
3.0.11
Reproduction link
Steps to reproduce
Check the JS compile result.
What is expected?
Result is:
const {} = (() => 1);
const {} = useSomthing((() => 1));
const {} = useSomthing(computed((() => 1)));
What is actually happening?
Result is:
const {} = ( => 1);
const {} = useSomthing(( => 1));
const {} = useSomthing(computed(( => 1)));
@johnsoncodehk Assigning a value to {}
is not a wise choice, because {}==={}
returns false
and you will never be able to use the {}
you defined.
But I think in this case, it would be better to report an exception when compiling.
@ygj6 this is just to show the problem, I use something like ref: ({ foo } = useSomthing(...))
in real code, thanks.