Skip to content

Commit de6053c

Browse files
Using ComponentPublicInstance with template refs (#2251)
* Using ComponentPublicInstance with template refs * Remove .html --------- Co-authored-by: Natalia Tepluhina <tarya.se@gmail.com>
1 parent 1faadee commit de6053c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/guide/typescript/composition-api.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,3 +400,12 @@ const openModal = () => {
400400
```
401401

402402
Note if you want to use this technique in TypeScript files instead of Vue SFCs, you need to enable Volar's [Takeover Mode](./overview#volar-takeover-mode).
403+
404+
In cases where the exact type of the component isn't available or isn't important, `ComponentPublicInstance` can be used instead. This will only include properties that are shared by all components, such as `$el`:
405+
406+
```ts
407+
import { ref } from 'vue'
408+
import type { ComponentPublicInstance } from 'vue'
409+
410+
const child = ref<ComponentPublicInstance | null>(null)
411+
```

0 commit comments

Comments
 (0)