templateRef  
 
Stability:  
officialAutomatically infer type for templateRef (from VueUse) and useTemplateRef (Vue 3.5+).
WARNING
This feature is officially supported since Volar (vue-tsc) v2.1.0. Vue Macros is no longer offering this feature as a plugin.
| Features | Supported | 
|---|---|
| Volar | ✅ | 
Basic Usage 
vue
<script setup lang="ts">
import { templateRef } from '@vueuse/core'
import { Comp } from './Comp.ts'
const comp = templateRef('comp')
comp.value?.foo
</script>
<template>
  <Comp ref="comp" />
</template>ts
import { defineComponent } from 'vue'
export const Comp = defineComponent({
  setup() {
    return { foo: 1 }
  },
})Volar Configuration 
No configuration required.
 Kevin Deng
 Kevin Deng zhiyuanzmj
 zhiyuanzmj