File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -376,7 +376,7 @@ With Vue 3.5 and `@vue/language-tools` 2.1 (powering both the IDE language servi
376376In cases where auto-inference is not possible, you can still cast the template ref to an explicit type via the generic argument:
377377
378378``` ts
379- const el = useTemplateRef <HTMLInputElement >(null )
379+ const el = useTemplateRef <HTMLInputElement >(' el ' )
380380```
381381
382382<details >
@@ -438,7 +438,7 @@ In cases where the exact type of the component isn't available or isn't importan
438438import { useTemplateRef } from ' vue'
439439import type { ComponentPublicInstance } from ' vue'
440440
441- const child = useTemplateRef <ComponentPublicInstance | null >( null )
441+ const child = useTemplateRef <ComponentPublicInstance >( ' child ' )
442442```
443443
444444In cases where the component referenced is a [ generic component] ( /guide/typescript/overview.html#generic-components ) , for instance ` MyGenericModal ` :
@@ -467,7 +467,7 @@ import { useTemplateRef } from 'vue'
467467import MyGenericModal from './MyGenericModal.vue'
468468import type { ComponentExposed } from 'vue-component-type-helpers'
469469
470- const modal = useTemplateRef<ComponentExposed<typeof MyGenericModal>>(null )
470+ const modal = useTemplateRef<ComponentExposed<typeof MyGenericModal>>('modal' )
471471
472472const openModal = () => {
473473 modal.value?.open('newValue')
You can’t perform that action at this time.
0 commit comments