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 @@ Vue 3.5 と `@vue/language-tools` 2.1(IDE の言語サービスと `vue-tsc`
376376自動推論が不可能な場合でも、ジェネリック引数を使用してテンプレート参照を明示的な型にキャストすることができます:
377377
378378``` ts
379- const el = useTemplateRef <HTMLInputElement >(null )
379+ const el = useTemplateRef <HTMLInputElement >(' el ' )
380380```
381381
382382<details >
@@ -438,7 +438,7 @@ const compRef = useTemplateRef<FooType | BarType>('comp')
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
444444参照されるコンポーネントが[ ジェネリックコンポーネント] ( /guide/typescript/overview.html#generic-components ) の場合、例えば ` 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