1

I am new to Typescript. I have a project that uses bootstrap tour. All this while, I was using the simple implementation as given in the bootstrap tour API. When I move this code to Typescript, it gives me an error on the Tour class.

How can I call the Tour object from Typescript?

TheIntern
  • 71
  • 9

1 Answers1

1

I can be partially helpful... You need to install the type definitions for this package and then TypeScript will know what you're talking about. I normally install them by doing npm install @types/ and then the name of the package. But this one isn't available there. Someone seems to have made it here:

http://codegists.com/snippet/typescript/bootstrap-tourdts_mpalmr_typescript

So you could steal that code and include it in your project manually.

It looks like it has a dependency on jquery, but then I managed to install the type definitions for jquery as well and it looks like everything works.

You'll also have to import the class you want:

import Tour = BootstrapTour.Tour;

There might be a better/more elegant way of doing this but that might start you in the right direction.

Brendan Whiting
  • 494
  • 3
  • 13