To simplify the use of axios in my application, I used a prototype to declare it globally.
const instance = axios.create({
baseURL: process.env.VUE_APP_BASE_URI,
withCredentials: true
});
Vue.prototype.$http = instance;
So far there is no problem, the problem arises when using it in any component
import vue from 'vue'; <- agregado solo para ver si solucionaba el problema
import { Component, Vue, Watch} from 'vue-property-decorator';
.....
this.$http.get('url')
.then(Response => )
This code rightly indicates for typescript:
"Property '$http' does not exist on type 'YourComponent'."
So, how do you get typescript to recognize that and not go around protesting that you don't know what it is?
In the official documentation you have how to do it : You take the declaration of the class and increase it :
So you should be able to do something like
###Explanation:
In Typescript it is equivalent to make this declaration
What is another: