TheIntern
TheIntern

Reputation: 81

Using bootstrap tour with Typescript

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?

Upvotes: 1

Views: 744

Answers (1)

Brendan Whiting
Brendan Whiting

Reputation: 504

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.

Upvotes: 1

Related Questions