[Vuejs]-Errors compiling Vue with TypeScript

0👍

It seems that this piece of code was missing:

declare module 'vue/types/vue' {
    interface Vue {
        status: string
    }
}

This is required for extend the Vue instance with additional properties.

To be honest the documentation contains this, just I wasn’t sure about the usage for this scenario.

https://v2.vuejs.org/v2/guide/typescript.html#Augmenting-Types-for-Use-with-Plugins

👤Sarun

0👍

The compilation error is occurring because the IStatus interface is extending Vue and the Vue interface requires much more than just a “status” property.

Try this:

export interface IStatus {
    status: string;
}

0👍

If anyone is still struggling, use the vue cli instead of manually creating & importing a store

npx @vue/cli add vuex

Leave a comment