Error is shown for property not found for properties that are a member of this single page component
See original GitHub issueInfo
- Platform: Windows 10
- Vetur version: 0.27.0
- VS Code version: 1.48.2
Problem
Vetur throws an error when using Vue in a single page component with a computed property.
Property 'foo' does not exist on type 'CombinedVueInstance<CombinedVueInstance<Vue, unknown, unknown, unknown, Record<never, any>>, object, object, object, Record<never, any>>'.Vetur(2339)
There is no error message in the Vue Language Server.
Reproducible Case
Create a new component and add props
and data
. Then add a computed
property.
Sample component:
<template>
<div>
{{ foo }}
{{ name }}
</div>
</template>
<script>
export default {
name: "Test",
props: ["foo", "bar"],
data() {
return {
name: "Joe",
};
},
computed: {
upperName() {
return this.name.toUpperCase();
},
},
};
</script>
Reference commit: https://github.com/firstclown/property-not-found-vetur-issue/commit/52ced82e2a1e31b4f5c2d3cbbc76518562e43de4
Issue Analytics
- State:
- Created 3 years ago
- Reactions:11
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Resolve "Property does not exist on type 'Vue'" error
I had the same problem but with exporting component. Some vs code snippets create template without necessary typo like this below
Read more >Inheritance and the prototype chain - JavaScript | MDN
An inherited function acts just as any other property, including property shadowing as shown above (in this case, a form of method overriding)....
Read more >Standard Lightning Page Components - Salesforce Help
Standard components are Lightning components built by Salesforce. Several standard components are available when creating Lightning pages.
Read more >Built-in directives - Angular
Attribute directives listen to and modify the behavior of other HTML elements, attributes, properties, and components. ... Built-in directives use only public ...
Read more >Verify your site ownership - Search Console Help
Multiple people can verify ownership of the same website property, using the same ... is listed in the verification wizard, then this is...
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
Try disabling the new setting:
vetur.validation.interpolation
.At least if you don’t care about potential real issues being reported. Otherwise, annotate your JS code with JSDoc annotations where typescript can’t infer types automatically.
@rodrigoriome You can still make types work in this case by making typescript aware of types you are returning from
asyncData
by also declaring them indata
. Something like:So no, disabling automatically, in that case, wouldn’t be expected. I’m using Nuxt with type checking all the time.