Description
Vue - Official extension or vue-tsc version
2.1.X
VSCode version
1.92.2
Vue version
3.4.48
TypeScript version
5.5.4
System Info
System:
OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
CPU: (16) x64 AMD Ryzen 9 5900HS with Radeon Graphics
Memory: 4.67 GB / 7.76 GB
Container: Yes
Shell: 5.8.1 - /usr/bin/zsh
Binaries:
Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
Yarn: 4.3.1 - ~/.nvm/versions/node/v20.11.1/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
Steps to reproduce
Once I updated the library's version to 2.1.X, all prop types defined in setup
macros were not correctly inferred inside the template
.
What is expected?
The following image is using v2.0.X, where the src
prop type is correctly inferred as string | unknown
, and JSDocs are also loaded
What is actually happening?
In the image below you can (left side) see how I use the defineProps<Type>()
macros to define the props of my component, but on the template (right side) the type inference of the src
prop is not inferred correctly
Oddly enough, variables explicitly defined in the setup
will be inferred correctly. So if I explicitly use the props, the types are loaded correctly:
Link to minimal reproduction
Any additional comments?
I have to admit that I tried reproducing a minimal reproduction with a fresh yearn create vite
, but couldn't reproduce it. However, this issue is happening across all my projects, which use different vue, node, and vite versions. If needed I can try trimming down a project little by little until I find the combination of elements that's triggering the issue, but that would have to wait until the weekend
Thank you very much for all your help and time that goes into this 🙌
Update: upon further testing, I realized that the issue rises when I use yarn's nodeLinker: pnp
, I have provided a link that fails. I just did a yarn create vite
and changed yarn to pnp