2

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:

enter image description here

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.