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

Type helper: ComponentProps not working correctly with generic components. #4922

Open
Dtsiantaris opened this issue Oct 14, 2024 · 0 comments

Comments

@Dtsiantaris
Copy link

Vue - Official extension or vue-tsc version

2.1.6

VSCode version

1.93.1

Vue version

3.5.12

TypeScript version

5.7.0

System Info

No response

package.json dependencies

{
  "dependencies": {
      "vue-component-type-helpers": "^2.1.6",
  }
}

Steps to reproduce

  1. Go to the repro link
  2. Check the generic props inside Generic.vue
  3. Notice in the App.vue the types are inferred correctly inside the template
  4. Inside the script, using the type helper, it does not work the same way

What is expected?

The type helper to extract the prop types correctly, respecting the generic constraints

What is actually happening?

The type helper ingores the generic constraints

Link to minimal reproduction

https://play.vuejs.org/#eNp9VGFv2jAQ/Ss3axJUComg25csMG1TNW1IDHVoX3A10uRgaYMd2Q4FRfnvOzsEKG3JB3DOd+/e8z2nYl+Kwt+UyEIW6URlhQGNpiwgj8VqyJnRnI24yNaFVAa+o0CVJbBUcg0dP9i/W4AOF1yYXYHwTVKyQGGmShY6mo1gCDPArUGRahD4BF3f92O10iHEYncFwxFUXAC8L2xBCJlYooLpJy5qG/4MEykmZZ7H9zlGU2IDEJ4gdp+XefACnf5tkYWaNosQqprwD5xvtkbFicHUcSbCZyJskly2+okCF4kU2sC+94t6J0jIFGlzXkHnEXf9TgidTZyX2O/Ud55NMKjNGHcUp+MjsVHQzMA1iAyuizw26BRH7dkTeYdLw5lX57ie6zQ4RAbUibNGc/PYlj3KoXLOICDsKDhpxDwaOUlbZiv/QUtBvnBSOEvoRLIc1a/CZCSdMzrDBpizOM/l008XM6pEp83V/MPk8ZX4g97aGGdThRrVBjk77BmaHZpm++b3hKZ8srmWaZlT9oXNW9QyLy3HJu1rKVKifZLn2P5wjs7EaqZpeCh0K8oStZm1y+eMvG3N8Jb0I91r/4Oro0nSKZ5cjUt3y1asmlSKTA6mvsVEqjTSRhFFjww8mt9548M2DZDsOJmLcn2Pyo3YecaZ+RUPTp7ZbUwUnftTXGYCG4u731H36rIL02zjFrR81+uB64dKSaXp/sFCNie0oCuXtm9/rBEX0Ou1hYTROnLTW0pFwruWpkcQKW6vLJKjfXRu2DjW7bfRPRxAtR+GfYIAmq7HkIVq32r3RSEOQSukXZ3fgr8bVNYTNLxr/6PfH7D6P7V6sBA=

Any additional comments?

This is the same ComponentProps used in vue-component-type-helpers. It does not work as expected when used on generic components.
But the template itself correctly manages to infer the types. So it should be possible, no?

Thanks in advance for anyone spending some time on this!

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

1 participant