From 3fd88aed9e86f3bf7cd81659a640abdb4e820902 Mon Sep 17 00:00:00 2001 From: skirtle <65301168+skirtles-code@users.noreply.github.com> Date: Sat, 25 Feb 2023 18:06:16 +0000 Subject: [PATCH 1/2] Using ComponentPublicInstance with template refs --- src/guide/typescript/composition-api.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/guide/typescript/composition-api.md b/src/guide/typescript/composition-api.md index 69e98b67fe..ba19c32022 100644 --- a/src/guide/typescript/composition-api.md +++ b/src/guide/typescript/composition-api.md @@ -417,3 +417,12 @@ const openModal = () => { ``` Note if you want to use this technique in TypeScript files instead of Vue SFCs, you need to enable Volar's [Takeover Mode](./overview.html#volar-takeover-mode). + +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`: + +```ts +import { ref } from 'vue' +import type { ComponentPublicInstance } from 'vue' + +const child = ref(null) +``` From 9769264885721070b1c2c825ab5dd38662532ad8 Mon Sep 17 00:00:00 2001 From: skirtle <65301168+skirtles-code@users.noreply.github.com> Date: Sat, 11 Mar 2023 09:25:41 +0000 Subject: [PATCH 2/2] Remove .html --- src/guide/typescript/composition-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/guide/typescript/composition-api.md b/src/guide/typescript/composition-api.md index 810e2406b4..86b20c379b 100644 --- a/src/guide/typescript/composition-api.md +++ b/src/guide/typescript/composition-api.md @@ -399,7 +399,7 @@ const openModal = () => { ``` -Note if you want to use this technique in TypeScript files instead of Vue SFCs, you need to enable Volar's [Takeover Mode](./overview.html#volar-takeover-mode). +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). 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`: