vuejs / core

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
https://vuejs.org/
MIT License
47.66k stars 8.33k forks source link

Incorrect Union Types Suggestions in Vue + TypeScript Project #11758

Open matvejs16 opened 2 months ago

matvejs16 commented 2 months ago

Vue version

3.5.0-rc.1

Link to minimal reproduction

https://play.vuejs.org/#eNq1VFtv0zAU/iuWXwrSmgwKCEVZEUx7gAeYgEdLU0hOizfHNr6ETl3++85xlq7d1kmTtodK9fedy3duWfPP1mZdBF7w0tdO2sA8hGjnQsvWGofPtlLquHINWzjTskmWB/Dh2LTJbyJ0mQ+O6IKPAK1VVQB8MVbeOtOTseJfrHSQ4fJI8NlbwW9Q66A7e5iStdGITKJUDH9TqTsja8w7GiipL8ggr5pW6ty4BpxHmuVPkvD8eVJRPrbo9PHD4d5EEJ2Z1tLVan8yXyl4NNcLpClxzptR8gMePEZcyGV27o3GdVlTDMFrXASpwP2wQRrtBS9YYohDkeb/t4QFF+FgxOu/UF88gJ/7FWGCnzrw4DoQfMOFyi0hDPTJr++wwv8bsjVNVGj9CPkTvFGRNA5mX6JuUPaWXVL7NS291Mvf/mQVQPuxKBJKln2yFxx3n25gX+m3cmfZu+QndE9d3Lodurmdc6HJ2krP12tmnbE+o/mwvscLI/jOTPC5fbFMVXqJwwwoBNlwaYFRJqNBh1MKx44GfeMBFEzH9g+4VNHOCX7aoWiVCuaDw7YkgGSNAJbFroa4uIT3QyL4tGhUGJr4MPQARTewkBpSCeVuRfNXr7e+P9jesw6PEoeBrZ1l77PDqauzN7y/Bk7XnxI=

Steps to reproduce

What is expected?

VSCode/Typescript compiler should indicate missing or incorrect props based on the defined union types.

What is actually happening?

VSCode/Typescript does not correctly handle union types for Vue component props. Instead of displaying accurate suggestions or flagging missing/incorrect props, it either provides no feedback or incorrect suggestions. This issue disrupts the development process, making it difficult to catch errors related to prop types in Vue components.

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11700K @ 3.60GHz
    Memory: 24.78 GB / 31.87 GB
Binaries:
    Node: 20.10.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.9.2 - ~\AppData\Local\pnpm\pnpm.EXE
Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527

Any additional comments?

This issue seems related to how the Vue compiler handles union prop types. Issue context can be found here for more understanding: vuejs/language-tools#4053

Shyam-Chen commented 2 months ago

8952 #9125