Template ref type inference is incompatible for components with defineEmits
and VueUse composables
#5155
Labels
defineEmits
and VueUse composables
#5155
Vue - Official extension or vue-tsc version
2.2.0
VSCode version
N/A
Vue version
3.5.13
TypeScript version
5.7.3
System Info
package.json dependencies
Steps to reproduce
npm run type-check
commandWhat is expected?
type-check
script completes without errors.What is actually happening?
type-check
script fails with the following errorLink to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-ypjynt2e?file=src%2FApp.vue,src%2FComponent.vue
Any additional comments?
Current workaround is to import
MaybeElementRef
type fromvueuse
and cast the value.Removal of
defineEmits
also removes type-check error.I'm not exactly sure what's causing it and maybe
vue-tsc
is correct here. Though decided to start an issue here to investigate at the highest level first. If this turns out to be upstream issue atVueUse
or evenvue
- I will reopen there.The text was updated successfully, but these errors were encountered: