Skip to content

ComponentExposed seems to be completely empty #11459

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

Closed
TheDutchCoder opened this issue Jul 30, 2024 · 4 comments
Closed

ComponentExposed seems to be completely empty #11459

TheDutchCoder opened this issue Jul 30, 2024 · 4 comments

Comments

@TheDutchCoder
Copy link

Vue version

3.4.34

Link to minimal reproduction

https://play.vuejs.org/#eNqFU01v2zAM/SuEMCApkNjY2pPnBNiGHDagW9HlVhVDYNOOOlkSJNlL4Pm/j5LztWJrDwZIPvLxkZR79sGYpGuRZSx3hRXGg0PfGpAbVS84846zJVeiMdp66MFiNYN7rGCAyuoGJlQ7OeG3+0+6MQckSUc30J9T/N4g8QRAK1R+tTPaYXnJNy+O4Dxkz7coDVo3eX+hQ6tb3Sr/d2HI4KrQynlo9qQyC1Lz573ywKqrg9ol/AbVSrmERZhuGuyrwHNqMZ1ewWIJPVcAgVxLTKSup7FF0m1ki8kbDEUDfXk67pG2Ro7HxsiNR/IA8sN+qA2tNpZzBlmlNbkPPYgyg7cwzGi+YL6D4ZHwlGrz9IKIzegsJKQSdfLktKLbRW2chcUJifab8YKEcpaNqgO2kVL/+hJj3rY4O8aLLRY//xF/crsQ4+zOokPbIWcnzG9sjX6EV9+/4o7sE9jospWU/QJ4j7TENmgc0z62qiTZF3lR7ed4baHqtVvtPCp3HCoIDZlDzOeMbh8W+7/Rz3Kvk5tYR6eiLZ7f50vPH2pUaEVB7jr+DCVWQuGd1cblsQcdMIP1wyOxLqevPIFSdNEg00A3r7QNbbY0JAgVmKhF38MYGYY8NWNdOhY+fwg/OvozaGAagGZLrm/Y8AeQ1kpf

Steps to reproduce

When trying to type the template ref of a component defined with a generic, we're told to use ComponentExpose (https://vuejs.org/api/sfc-script-setup#generics). This seems to "work" in the sense that it doesn't throw TS errors like InstanceType does, but the type itself is completely empty and useless.

For example, myRef.value has no properties anymore, so you can't really use it practically speaking.

In the repro you can see that .$el doesn't exist on the type for example, whereas it really does exist of course.

What is expected?

The full type to be returned of the component instance.

What is actually happening?

Nothing is returned in the type and the IDE also doesn't know what to do with it (no autocomplete for example).

System Info

No response

Any additional comments?

No response

@jh-leong

This comment was marked as outdated.

@yyx990803
Copy link
Member

ComponentExposed is used to extract explicitly exposed properties via defineExpose() or setupContext.expose(), not the component instance type.

@yyx990803 yyx990803 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 31, 2024
@TheDutchCoder
Copy link
Author

Okay interesting, this issue here recommends using it: vuejs/language-tools#3206
Maybe there's some misunderstanding on my side and these are different issues?

@github-actions github-actions bot locked and limited conversation to collaborators Aug 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants