title: How to access Vue prototype property from typescript component
body: <p>I'm migrating my vuejs app to typescript for better maintanability. Here is my problem:</p>
  
  <p>I created a <code>TokenService</code> to retrieve the admin's token from the local storage :</p>
  
  <pre><code>// token.service.js
  
  /*
    Get the admin's token from localstorage.
    @return {object} The token
  */
  getToken() {
    return localStorage.getItem("token")
  }
  </code></pre>
  
  <p>To have the service available in all the components without having to import it in each one of them, I added the service to the <code>Vue.prototype</code> :</p>
  
  <pre><code>// main.js
  
  Vue.prototype.$tokenService = TokenService
  </code></pre>
  
  <p>But when I try to access the <code>this.$tokenService</code> from my component <code>AdminWorkerPage</code> written in typescript, I get the error: <em>TS2339: Property '$tokenService' does not exist on type 'AdminWorkerPage'.</em></p>
  
  <pre><code>// AdminWorkerPage.ts
  
  import { Vue, Component, Prop } from 'vue-property-decorator'
  
  @Component({})
  export default class AdminWorkerPage extends Vue {
  
    broadcast(): Promise&lt;void&gt; {
      token: this.$tokenService.getToken() // &lt;-- $tokenService used here !
      ...
    }
  }
  </code></pre>
  
  <p>But when my file was written in javascript, I had no problem.</p>
  
  <p>How can I tell the compiler that the property exists in the component?</p>