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

Import script setup component with generics breaks defineComponent #11866

Closed
yvangrdv opened this issue Sep 9, 2024 · 4 comments
Closed

Import script setup component with generics breaks defineComponent #11866

yvangrdv opened this issue Sep 9, 2024 · 4 comments
Labels
language-tools related to vue language-tools scope: types

Comments

@yvangrdv
Copy link

yvangrdv commented Sep 9, 2024

Vue version

3.5.3

Link to minimal reproduction

https://play.vuejs.org/#eNqdUsGO00AM/RVrLrtIq/RQuJRsJUCLBBKwYitOI6EhcUOWiWc0MylFUf4de5qm0Qo4cEpsP795tt+gXnlfHHpUG1XGKrQ+bTW1nXchwQA17lvCN45jQkowwj64Dq644erljJP6VChWEgih1DXhMSOYx/Q2f5d814MmADIdbkCLEq1uJFOdAXEDGQL5DfkbM6A2ycylvXPS/s0ErTJE0/hMU7ma5+EgYeetScgRQFm3h+0wSCeMY7mSMOflYVjxf7laNKgblWLlaN82xWN0xLvKT2sl+NZi+ORT6yhqNYvSyljrfr7PuRR6zLpzz3esfvwh/xiPktPqPmDEcMBpGVJLJjSYTuW7h4945P+52Lm6t4z+R/EzRmd70XiCve6pZtkLXFb7Lt+zpWYX744JKZ6HEqGX7WvF95WD/G30i9x18fx8Et7i2RsXs0HE1Huwhppb7mMaaJAwtBWHO+BZkOoIMQVWpdXSm/fB+d0vj09NqYlPFRPw5Gi/GNsj3E7G+yCpcre9ZnuwzgnomSjOGKGNJ2NmY01DJX5pAw9Zx7S0ydT/470TwdvMPyyVjkzAmMmRT1349YBBbsL7WxcvirUafwMk3UGc

Steps to reproduce

1 - Create a script setup component with a generic
2 - Use it in another component in option api with defineComponent

What is expected?

No error

What is actually happening?

"No overload matches this call." error on defineComponent method and component typescript inference is broken.

System Info

No response

Any additional comments?

No response

@jh-leong
Copy link
Member

jh-leong commented Sep 9, 2024

In your reproduction link, the data in the Options API should be a function. See Playground

Could you also confirm if the link you provided is correct?

@yvangrdv
Copy link
Author

yvangrdv commented Sep 9, 2024

My bad, I paste the wrong link. This is the good link : https://play.vuejs.org/#eNqVVE1v1DAQ/Ssjn7ZSyR4WLqu0EkVFgARUdMUFI+Qmk2yKY0e2ExaF/HfGzke9VVu1viQzfva8mXnjnr1tmqRrkW1ZajNTNQ6kUOUZZ85yds5VVTfaOOghx6JS+E6TrVA5GKAwugbO6DRnC/BCGI+ZN5P15PBBItgOrTvGzZ4ZyBUeApQCi1aGb0xg1XMFtJSocUs3UCKcnY6+bAbZLUwwvyYqE8ivOejkGqZvLpyA1Ul81qBrjYo9fjnt9BacaTG6dDi+rEa31/kxE0dx7wUI7n1lE38nnEEhpMXo0ojicMJVuh7bRS0iw2HdSOGQLID0RphXvgSwHu2l2N5O1xGYnVKfM62KqkxurVYkg0CJM3++kmi+Nq7SirSw8OdMSKn/fAq+KHU6s8fs9wP+W3vwPs6uDFo0HfV32XPClOjG7cvrL3ig/2Wz1nkrCf3E5je0Wrae4wi7aFVOtCNcYPsxyK5S5c5eHhwqOyfliXrkWN+gZl+qx1K/o7tJXodz1A6qYqTyaJQsiaaJBwpKVGiqjMwdUDqocgvWGSL24yf8gxutJQpKJbSVGkMyoTxRfheyRVLFOASfvSvdna9ICDOsMbqxC+LKW/OIFJpEGqvvb0Mjcx3CRrqdBs1XkRS0VPA5isurLvwABGqdZ0sh+5j8MM3F+8CmHwknxG3aSdfjLfcFGj8Md7V9ydP00qdkjhhK8JzUPyBp7DH+vzo0Xm7EfZO8STZs+A9m0Mhz

But no error was trigger on this example, however the same code display an error in VSCode

image

image

image

image

VSCode version

Version: 1.92.2 (Universal)
Commit: fee1edb8d6d72a0ddff41e5f71a671c23ed924b9
Date: 2024-08-14T17:29:30.058Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.6.0

System Info

System:
OS: macOS 14.6
CPU: (8) arm64 Apple M1
Memory: 100.78 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.17.0 - ~/.nvm/versions/node/v20.17.0/bin/node
npm: 10.8.2 - ~/.nvm/versions/node/v20.17.0/bin/npm
Browsers:
Chrome: 128.0.6613.120
Safari: 17.6
Safari Technology Preview: 18.0
npmPackages:
vue: ^3.5.3 => 3.5.3

I also use Vue - Official extension v2.1.6 and Typescript 5.3.4.

@jh-leong jh-leong added scope: types language-tools related to vue language-tools and removed can't reproduce labels Sep 9, 2024
@svannierswm
Copy link

I have the same issue using PHPStorm :
image

PHPStorm information :

PhpStorm 2024.2.1
Build #PS-242.21829.154, built on August 29, 2024
Runtime version: 21.0.3+13-b509.11 amd64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

Vue server :
image

I encounter the same errors using vue-tsc in version 2.1.6.

System information :

System:
OS: Linux 6.8 Fedora Linux 40 (Workstation Edition)
CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
Memory: 3.90 GB / 15.39 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 20.17.0 - ~/.nvm/versions/node/v20.17.0/bin/node
npm: 10.8.2 - ~/.nvm/versions/node/v20.17.0/bin/npm
Browsers:
Chrome: 128.0.6613.84
npmPackages:
typescript: ~5.5.4 => 5.5.4
vue: ^3.5.3 => 3.5.3

@KazariEX
Copy link
Contributor

KazariEX commented Sep 9, 2024

It should be fixed by vuejs/language-tools#4823

@edison1105 edison1105 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 9, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
language-tools related to vue language-tools scope: types
Projects
None yet
Development

No branches or pull requests

5 participants