I have a Vue.js project that's giving me weird errors/warnings in VS Code:
- This happens whenever I pass a value as a prop to one of my custom components - it doesn't happen on Vuetify components for example
- It always displays this warning only on the first prop
- It doesn't matter what type the prop is or what you pass to the prop
- The project compiles with no errors, there's no errors in the browser console log either, and my project works just fine
- I use the "regular/default" component style, not the class-based component style
- I use TypeScript
Here's how the prop in the example image is defined in the child element that receives its value:
import Vue from 'vue';
export default Vue.extend({
name: 'MyCustomComponent',
props: {
title: String,
},
data: function () {},
});
How can I get rid of these "useless" warnings?
Edit
As requested, here are the parent and child component scripts:
App.vue
<template>
<v-app>
<v-main>
<hello-world :title="title" :heading="heading" />
</v-main>
</v-app>
</template>
<script lang="ts">
import Vue from 'vue';
import HelloWorld from './components/HelloWorld.vue';
export default Vue.extend({
name: 'App',
components: {
HelloWorld,
},
data: () => ({
title: 'Title!',
heading: 'Heading!',
}),
});
</script>
HelloWorld.vue
<template>
<v-container>
<v-row class="text-center">
<v-col class="mb-4">
<h1>
{{ title }}
</h1>
<h2>
{{ heading }}
</h2>
</v-col>
</v-row>
</v-container>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
name: 'HelloWorld',
props: {
title: String,
heading: String,
},
data: () => ({}),
});
</script>
