Summer Sale! All accounts are 50% off this week.

topvillas's avatar

Typescript, Vue and axios

This is a long shot but maybe somebody can help me out.

So, I've created a vue app using the CLI, and added axios which creates a plug-in file to configure and attach an axios instance to the Vue prototype. All good!

Under normal circumstances, you can access it with this.$axios.get('theurl') as you'd expect. But I'm using typescript so trying to use this.$axios results in Property '$axios' does not exist on type 'X'.

Any ideas on how to get around this would be much appreciated.

I could just create my own module to configure and export an axios instance but I'd prefer to do it in the idiomatic Vue way if at all possible.

0 likes
1 reply

Please or to participate in this conversation.