Assuming SomeComp is a custom component exposing a function open, in a template I can do this:
<button @click="$refs.someComp.open()">Open</button>
<SomeComp ref="someComp" />
However when running type check, vue-tsc will fail with
TS2571: Object is of type 'unknown'
coplaining about the someComp ref.
How do I resolve this?
Can the type somehow be inferred or Do I have to declare it again?
In a ref<>?
Yes, you need to define is as a ref.
In
script setupthis would look likeDon't use $refs as it's untyped iirc