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.

Typescript: Property 'foo' does not exist on type 'Vue'.

See original GitHub issue

Version

2.5.17

Reproduction link

https://stackblitz.com/edit/typescript-bc9ywj

Steps to reproduce

  1. open index.ts, you will see:

image

  1. change x: [String, Number, Array] to x: [String, Number], then errors disappear:

image

What is expected?

no typing errors.

What is actually happening?

typing errors exist.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

84reactions
posvacommented, Oct 15, 2018

Check https://vuejs.org/v2/guide/typescript.html


Please, next time consider using the forum, the Discord server or StackOverflow for questions first. But feel free to come back and open an issue if it turns out to be a bug 🙂

6reactions
ITsolution-gitcommented, Mar 6, 2020
export default Vue.extend({
    name: 'WebWhatsNew',
    data() {
        return {
            currentSlide: 0 as number
        };
    },
    methods: {
        nextSlide() {
            this.currentSlide += 1;
        },
    },
    computed: {
        internalOpen: {
            get(): boolean {
                return this.value;
            },
            set(val) {
                (this as any).$emit('input', false);
            },
        },
    },
});

I get this typing error with the code above. image

When I remove

            set(val) {
                (this as any).$emit('input', false);
            },

then the compile error is gone.

Edit: I fixed the issue by set(val: boolean) , adding type to val.

It’s my mistake not to add type to val but the lint should give the proper error. However it fixes automatically when you try to fix the other typing issues.

Hope it helps anyone who hits the similar issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve "Property does not exist on type 'Vue'" error
Resolve "Property does not exist on type 'Vue'" error · Ensure you include the ".vue" extension in the filename being imported · Add...
Read more >
[Vue + Typescript] Property does not exist on type in computed ...
I still facing this issue and none of solution above can work for me! The warning Property 'xxx' does not exist on type...
Read more >
Typescript: Property 'foo' does not exist on type 'Vue' - Sami C.
When I added a type on my setter val the error was no longer present! set(val: boolean) { (this as any).$emit('input', false); },....
Read more >
‍♂️ ‍♀️ Vue 3 error with using TypeScript: property X does ...
‍♂️ ‍♀️ Vue 3 error with using TypeScript: property X does not exist on type 'EventTarget' · Simple Errors (3 Part Series) ·...
Read more >
Vue/Typescript 3.5.1 Error: 'property' does not exist on type 'Vue'
Currently I downgraded Typescript back to 3.4.5. Is there any solution to solve the problem, maybe an updated definition file? Thanks for your ......
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