Property 'X' does not exist on type CombinedVueInstance using TypeScript Prop Validator
See original GitHub issueVersion
2.5.16
Reproduction link
https://codepen.io/muhammadrehansaeed/pen/XPWKyJ
Steps to reproduce
Use Typescript to build this component:
export default Vue.extend({
props: {
delay: {
default: 600,
type: Number,
validator: function(value: number) {
return value >= 0;
}
},
minValue: {
default: 0,
type: Number
}
},
data() {
return {
valueInternal: 0
};
},
methods: {
reset(): void {
this.valueInternal = this.minValue; <----THIS LINE ERRORS
}
}
});
What is expected?
The component builds.
What is actually happening?
The following error is thrown:
Property 'minValue' does not exist on type 'CombinedVueInstance<Vue, { isVisibleInternal: boolean; valueInternal: number; }, { reset(): void; }, {}, Readonly<{}>>'.
methods: {
reset(): void {
this.valueInternal = this.minValue;
^
}
}
If I remove the validator from the prop, the error goes away. If I remove the data section, the error also goes away.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:9
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Property 'XXX' does not exist on type 'CombinedVueInstance ...
Solution: i have added declaration to component. <script lang="ts"> import Vue from 'vue'; // Add ...
Read more >Property 'xxx' does not exist on type CombinedVueInstance
I typed all return types of methods in computed / data. Typescript still says, that props being used in a method in computed...
Read more >[Help] Property 'x' does not exist on type ... - Reddit
Hi! New to Vue/Nuxt. I am having an issue with Nuxt and TypeScript tutorial. Nuxt build throws these errors. ERROR in…
Read more >[Solved]-How to fix "Property XX does not exist on type ...
Coding example for the question How to fix "Property XX does not exist on type 'CombinedVueInstance" errors in VSCode? (Vue with Typescript)-Vue.js.
Read more >FAQ | Vetur - GitHub Pages
If you are getting a lot of Property 'xxx' does not exist on type 'CombinedVueInstance' errors, it's an issue with Vue's typing and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
if you do
seems to be working, typescript seems not picking up the type
I had this happen with a Date prop. If I had just the type, it was ok:
But when I added a default value, everything broke in the component:
Unless you cast the object like mentioned above:
For anyone googling the seemingly unrelated error, you will get this for every property in your component: