I've created a custom class-based vue component and I'm trying to access its methods and/or computed properties from a parent component. There is an example in the Vue Docs that explains what I'm trying to do (https://v2.vuejs.org/v2/guide/components-edge-cases.html#Accessing-Child-Component-Instances-amp-Child-Elements). So basically it's this
class ParentComponent extends Vue {
someMethod() {
(this.$refs.myChildRef as ChildComponent).focus()
}
}
class ChildComponent extends Vue {
focus() {
// do something
}
}
Now, this leads to a TS error: "TS2339: Property 'focus' does not exist on type 'Vue'"
So apparently, typescript doesn't see that my ChildComponent has additional methods.
The code still works during runtime though, so it just appears to be a typescript issue.
Does anyone have an idea how to solve this?