[Vuejs]-TypeScript self reference

0๐Ÿ‘

@lena was shared this link to the Vue official instruction:
https://v2.vuejs.org/v2/guide/typescript.html#Augmenting-Types-for-Use-with-Plugins

In my case I need to extend ComponentOptions like this

declare module 'vue/types/options' {
  interface ComponentOptions<V extends Vue> {
    constants?: {}
  }
}

and remove question mark from this line

readonly $consts: Vue['$options']['?constants']

so now in phpStorm *.vue files IDE is not warning about Unresolved variable or type $consts

Leave a comment