VueJS + Typescript: Property does not exist on type

Make a plugin file like below and use this plugin in main.ts

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

import _Vue from 'vue';
import Axios from 'axios';
export function AxiosPlugin<AxiosPlugOptions>(Vue: typeof _Vue, options?: AxiosPluginOptions): void {
   // do stuff with options
   Vue.prototype.$http = Axios;
 }
export class AxiosPluginOptions { // add stuff } 
import { AxiosStatic } from 'axios';
declare module 'vue/types/vue' {
   interface Vue {
     $http: AxiosStatic;
 }
}

It looks like you might be missing vue-axios, which adds $http to the Vue prototype, allowing this.$http() calls from single file components.

To address the issue:

  1. Install vue-axios from the command line:

    npm i -S vue-axios
    
  2. Add the following code in main.ts:

    import Vue from 'vue'
    import axios from 'axios'
    import VueAxios from 'vue-axios'
    
    Vue.use(VueAxios, axios)