Typescript: How to use bowser typings?

568 Views Asked by At

I'm updating an AngularJS project to Typescript using Webpack.

Because we are using bowser in our codebase I installed and referenced the related typings.

But still after done this the compiler keeps complaining that the bowser name is unknown.

Does someone know how to effectively use the bowser typings? It worked out of the box for the other libraries.

1

There are 1 best solutions below

0
On

In a separate *.d.ts file (I have one for miscellaneous shims since so many typings are terrible), you need to add this line:

declare var bowser: BowserModule.IBowser;

For some reason the typing currently doesn't include the actual instantiated object.