question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error is shown for property not found for properties that are a member of this single page component

See original GitHub issue
  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • 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>

image

Reference commit: https://github.com/firstclown/property-not-found-vetur-issue/commit/52ced82e2a1e31b4f5c2d3cbbc76518562e43de4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:11
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
rchlcommented, Sep 3, 2020

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.

1reaction
rchlcommented, Sep 3, 2020

@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 in data. Something like:

async asyncData() {
  const foo = await axios.get(...)
  return {
    foo,
  }
},
data() {
  return {
    /** @type {string | null}
    foo: null
  }
}

So no, disabling automatically, in that case, wouldn’t be expected. I’m using Nuxt with type checking all the time.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found