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
v1.8.10 Generics: defineComponent missing type overload definition when importing a script setup generic component #3257
Comments
#2709 Reoccurrance of this problem |
Not sure why, but I can't reproduce it now. |
I just tried it in v.1.8.11 in case it was fixed there. Unfortunately isn't. Are you reproducing in stackblitz or vscode? I've found the issue is not reproducible in stackblitz. |
In vscode. This is my reproduction: https://github.com/so1ve/language-tools/tree/fix/issue-3257. Am I doing something wrong? Maybe related to your vue / typescript version? |
Your parent component seems to have a script setup <script setup lang="ts"> and export defineComponent() all in one. In my example we just use defineComponent on parent and setup generic in child. :) Is using both valid or a mistake? |
Alright, that is odd. Well i am using ts 5.2.2 and Volar 1.8.11. I think i need to try to fork your test and see if it behaves then in case something in my project is throwing things off. Out of curiosity, are shims defined in your test?
|
No :D You don't need this if you enable take over mode. |
Think i need some help with the fork. I forked the project, checked out your branch fix/issue-3257 Ran npm i The problem is, there is no type hinting going on whatsoever. Note how i am using a Comp thats not defined, and things do not hint. Update Figured it out how to setup the fork; had to install some extra things. The type hinting is working here for me too. Going to look into this more. |
I think i figured it out. The error happens due to the new emits syntax introduced in 3.3+ Here is a minimal reproduction. Comp.d.ts
|
Thanks @Chuuone, this reproduction works 👍 |
Importing a child component defined using <script setup lang="ts" generic="T extends Record">
into a component defined using <script lang="ts"> and defineComponent() will cause typing issue specified below.
Example breakdown
Define a child component
// TableComponent.vue
Create a parent component defined using
MainComponent.vue
The typing issue
The text was updated successfully, but these errors were encountered: