I have created a Vue2 component that I want to place inside another Vue 2 component. I have created the component inside a TypeScript file.
const ChildrenAgeDropdown = {
props: ["option"],
data() {
return {
isOpen: false as boolean,
options: arrayFromXToY(0, 11),
};
},
methods: {
toggle(): void {
this.isOpen = !this.isOpen;
},
},
// ... The rest of the component.
}
The code works perfectly and the program doesn't crash.
However, I get the following Typescript error:
TS2339: Property 'isOpen' does not exist on type '{ toggle(): void; }'
I don't know why I. As you can see, I have declared the property isOpen as a property of the Vue component. What should I do to remove this annoying Typescript Error?
Here is a snapshot of my IDE (WebStorm) with the error:
