Skip to content

Property does not exist on the type in vue-class-component #360

Closed
@wizardnet972

Description

@wizardnet972

I created new vue with typescript application using latest @vue/cli (v3).
When I use component decorator from vue-class-component with computed/props/methods, I got an error:

Property 'count' does not exist on type 'HelloWorld'.Vetur(2339)

image

Here my code:

<script lang="ts">
import { Prop, Vue } from "vue-property-decorator";

import Component from "vue-class-component";

@Component({
  computed: {
    count() {
      return 'blabla';
    }
  }
})
export default class HelloWorld extends Vue {
  @Prop() private msg!: string;

  onClick() {
    const y = this.count;
  }
}
</script>

But according to the example it should be working fine. How do I fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions