I am working with Typescript on a Vue project which uses vue-resource. The project is working fine, but I am getting a typescript compiler error.
Notice that I am able to use the module using this.$http
in my components.
I have checked this, this, and this, answers but none of these helped. Is there a work around for this? Or is there a way to set global options in Vue-Resource with Typescript? Or a way to ignore the error altogether?
[Edit] Workaround (also attached as my answer):
One of the workarounds from @Styx 's comment (Github solution is significantly hacky as I refrain from manually making modifications to vue-resource/types/vue.d.ts
), mentioning here anyway.
Use generics and typecast Vue to any, example <any>Vue.http
. This however, might result in tslint warning, hence I solved this by using (Vue as any)
and then access (Vue as any).http