-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Open
Labels
Description
Vue version
3.5.21
Link to minimal reproduction
Steps to reproduce
<script setup lang="ts">
import { useTemplateRef , computed} from 'vue'
import DisplayN from './DisplayN.vue'
// The type of this variable is inferred as any
const compRef = useTemplateRef('compRef')
const delta = 1
const n = computed(() => compRef.value?.getN())
</script>
<template>
<DisplayN ref="compRef" :delta="delta" />
<input v-model="n"/>
</template>
See Demo for details
What is expected?
Automatically infer the type of compRef
What is actually happening?
compRef
is inferred as any.
System Info
Any additional comments?
If you removev-model="n"
or :delta="delta"
, the type of compRef
can be inferred correctly.🫠