Skip to content
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

vue.volar 2.1.X breaks SFC setup macros type inference in template #4751

Closed
auirarrazaval opened this issue Aug 29, 2024 · 8 comments
Closed

Comments

@auirarrazaval
Copy link

auirarrazaval commented Aug 29, 2024

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

image

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
image

Oddly enough, variables explicitly defined in the setup will be inferred correctly. So if I explicitly use the props, the types are loaded correctly:
image

Link to minimal reproduction

repo

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

@KazariEX
Copy link
Collaborator

I cannot reproduce on my machine, could you provide a minimal repro for it?

@auirarrazaval
Copy link
Author

@KazariEX Will provide one during the weekend!

@auirarrazaval
Copy link
Author

@KazariEX Actually I think i did identify correctly the issue: I updated the description above and provided a reproduction link

@KazariEX
Copy link
Collaborator

It seems that the repo does not exist.

@auirarrazaval
Copy link
Author

My bad, now it should be public

@WangJincheng4869
Copy link

我也遇到了差不多的问题,插件已经无法使用,只能回退 2.0.28

没有任何的提示信息,看上去插件没有生效。
图片

@PDieE
Copy link

PDieE commented Aug 30, 2024

same issue, so I returned version 2.0.28
⬇️ 2.0.28 ⬇️
QQ_1724985021313

⬇️ 2.1.x ⬇️
QQ_1724985091639

@codethief
Copy link

Same issue here, downgrading the extension to 2.0.28 fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants