A same name prop and variable will show wrong type
Version
3.2.31
Reproduction link
Steps to reproduce
- Open reproduction.
- Hover
a
of(new Comp()).a
insidesrc/components/Foo.ts
.
What is expected?
It shows string
.
What is actually happening?
It shows never
.
When a prop and a variable returned from setup has the same name, the variable returned from setup has higher precedence than a prop.
This can be confirmed by the fact that 55:
is rendered instead of 55
in the reproduction.
I can confirm this too. Furthermore, in @sapphi-red's example if you define the type of a
the returned type is an intersection of the two types. See updated example here.
I also think it is good to mention it somewhere in the docs that local variables inside the setup()
function have higher precedence than props.