2
votes

I've installed vue-tour component.

https://www.npmjs.com/package/vue-tour

In vue component in mounted method I have (code in typescript):

  mounted() {
    this.$tours['tourTabsNames'].start();

And when I compile above code I get error:

Error TS2339 (TS) Property '$tours' does not exist on type 'CombinedVueInstance

But when I remove $tours from code and run application and stop on debug mode (F12 in browser) I can call this.$tours['tourTabsNames'].start(); and it works. How to suppress error message in typescript while compiling code?

2
Did you configure vue-tour to integrate with Vue viaVue.use(VueTour)?PatrickSteele

2 Answers

2
votes

As workaround, you can just access it like that:

this['$tours']['tourTabsNames'].start();
0
votes
(this as any).$tours['tourTabsNames'].start();

"As any" instructs TypeScript to ignore typing in the statement.

From https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any :

TypeScript also has a special type, any, that you can use whenever you don’t want a particular value to cause typechecking errors.