Reputation: 11671
I got an error in my TypeScript component file that a prop doesn't exist, but I declared the prop exactly as described in the vue-class-component
documentation example.
Property 'propMessage' does not exist on type 'MyComponent'.Vetur(2339)
How do I fix this?
Upvotes: 10
Views: 4568
Reputation: 1070
The documentation you linked states:
Following is the example written in Babel. If you are looking for TypeScript version, it's in the example directory.
Example:
<script lang="ts">
import Vue from 'vue';
import { Component } from 'vue-class-component';
const AppProps = Vue.extend({
props: {
propMessage: String
}
})
@Component
export default class YourComponent extends AppProps {
get something() {
return this.propMessage;
}
}
</script>
Upvotes: 2